Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor RC cleanup #6722

Merged
merged 4 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions FirebaseRemoteConfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Objective-C and Swift.
Firebase Remote Config is a cloud service that lets you change the appearance
and behavior of your app without requiring users to download an app update.

Please visit [our developer site]
(https://firebase.google.com/docs/remote-config/) for integration instructions,
documentation, support information, and terms of service.
Please visit [our developer site](https://firebase.google.com/docs/remote-config/)
for integration instructions, documentation, support information, and terms of service.
7 changes: 0 additions & 7 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,11 @@
NSString *const FIRRemoteConfigErrorDomain = @"com.google.remoteconfig.ErrorDomain";
/// Remote Config Error Info End Time Seconds;
NSString *const FIRRemoteConfigThrottledEndTimeInSecondsKey = @"error_throttled_end_time_seconds";
/// Remote Config Developer Mode Key
static NSString *const kRemoteConfigDeveloperKey = @"_rcn_developer";
/// Minimum required time interval between fetch requests made to the backend.
static NSString *const kRemoteConfigMinimumFetchIntervalKey = @"_rcn_minimum_fetch_interval";
/// Timeout value for waiting on a fetch response.
static NSString *const kRemoteConfigFetchTimeoutKey = @"_rcn_fetch_timeout";

@interface FIRRemoteConfigSettings () {
BOOL _developerModeEnabled;
}
@end

@implementation FIRRemoteConfigSettings

- (instancetype)init {
Expand Down
44 changes: 24 additions & 20 deletions FirebaseRemoteConfig/Tests/Unit/RCNUserDefaultsManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

static NSTimeInterval RCNUserDefaultsSampleTimeStamp = 0;

static NSString* const AppName = @"testApp";
static NSString* const FQNamespace1 = @"testNamespace1:testApp";
static NSString* const FQNamespace2 = @"testNamespace2:testApp";

@interface RCNUserDefaultsManagerTests : XCTestCase

@end
Expand All @@ -36,9 +40,9 @@ - (void)setUp {

- (void)testUserDefaultsEtagWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setLastETag:@"eTag1"];
XCTAssertEqualObjects([manager lastETag], @"eTag1");

Expand All @@ -48,9 +52,9 @@ - (void)testUserDefaultsEtagWriteAndRead {

- (void)testUserDefaultsLastFetchTimeWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setLastFetchTime:RCNUserDefaultsSampleTimeStamp];
XCTAssertEqual([manager lastFetchTime], RCNUserDefaultsSampleTimeStamp);

Expand All @@ -60,9 +64,9 @@ - (void)testUserDefaultsLastFetchTimeWriteAndRead {

- (void)testUserDefaultsLastETagUpdateTimeWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setLastETagUpdateTime:RCNUserDefaultsSampleTimeStamp];
XCTAssertEqual([manager lastETagUpdateTime], RCNUserDefaultsSampleTimeStamp);

Expand All @@ -72,9 +76,9 @@ - (void)testUserDefaultsLastETagUpdateTimeWriteAndRead {

- (void)testUserDefaultsLastFetchStatusWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setLastFetchStatus:@"Success"];
XCTAssertEqualObjects([manager lastFetchStatus], @"Success");

Expand All @@ -84,9 +88,9 @@ - (void)testUserDefaultsLastFetchStatusWriteAndRead {

- (void)testUserDefaultsisClientThrottledWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setIsClientThrottledWithExponentialBackoff:YES];
XCTAssertEqual([manager isClientThrottledWithExponentialBackoff], YES);

Expand All @@ -96,9 +100,9 @@ - (void)testUserDefaultsisClientThrottledWriteAndRead {

- (void)testUserDefaultsThrottleEndTimeWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setThrottleEndTime:RCNUserDefaultsSampleTimeStamp - 7.0];
XCTAssertEqual([manager throttleEndTime], RCNUserDefaultsSampleTimeStamp - 7.0);

Expand All @@ -108,9 +112,9 @@ - (void)testUserDefaultsThrottleEndTimeWriteAndRead {

- (void)testUserDefaultsCurrentThrottlingRetryIntervalWriteAndRead {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setCurrentThrottlingRetryIntervalSeconds:RCNUserDefaultsSampleTimeStamp - 1.0];
XCTAssertEqual([manager currentThrottlingRetryIntervalSeconds],
RCNUserDefaultsSampleTimeStamp - 1.0);
Expand All @@ -122,14 +126,14 @@ - (void)testUserDefaultsCurrentThrottlingRetryIntervalWriteAndRead {

- (void)testUserDefaultsForMultipleNamespaces {
RCNUserDefaultsManager* manager1 =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];

RCNUserDefaultsManager* manager2 =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace2"];
namespace:FQNamespace2];

/// Last ETag.
[manager1 setLastETag:@"eTag1ForNamespace1"];
Expand Down Expand Up @@ -172,9 +176,9 @@ - (void)testUserDefaultsForMultipleNamespaces {

- (void)testUserDefaultsReset {
RCNUserDefaultsManager* manager =
[[RCNUserDefaultsManager alloc] initWithAppName:@"TESTING"
[[RCNUserDefaultsManager alloc] initWithAppName:AppName
bundleID:[NSBundle mainBundle].bundleIdentifier
namespace:@"testNamespace1"];
namespace:FQNamespace1];
[manager setLastETag:@"testETag"];
[manager resetUserDefaults];
XCTAssertNil([manager lastETag]);
Expand Down