-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[rc-swift] ConfigDBManager.swift #14126
Changes from 8 commits
19876a4
c1eefe4
6961223
3ce0a38
60bb915
991f9c9
849c138
ae8a5ed
84d4490
41a5138
f619a5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ @implementation FIRRemoteConfigValue { | |
} | ||
|
||
/// Designated initializer | ||
- (instancetype)initWithData:(NSData *)data source:(FIRRemoteConfigSource)source { | ||
- (instancetype)initWithData:(nullable NSData *)data source:(FIRRemoteConfigSource)source { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix for existing api usage |
||
self = [super init]; | ||
if (self) { | ||
_data = [data copy]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ | |
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigContent.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigDBManager.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigExperiment.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigRealtime.h" | ||
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h" | ||
|
@@ -142,6 +141,7 @@ - (instancetype)initWithAppName:(NSString *)appName | |
namespace:(NSString *)FIRNamespace | ||
DBManager:(RCNConfigDBManager *)DBManager | ||
configContent:(RCNConfigContent *)configContent | ||
userDefaults:(nullable NSUserDefaults *)userDefaults | ||
analytics:(nullable id<FIRAnalyticsInterop>)analytics { | ||
self = [super init]; | ||
if (self) { | ||
|
@@ -155,7 +155,8 @@ - (instancetype)initWithAppName:(NSString *)appName | |
_settings = [[RCNConfigSettings alloc] initWithDatabaseManager:_DBManager | ||
namespace:_FIRNamespace | ||
firebaseAppName:appName | ||
googleAppID:options.googleAppID]; | ||
googleAppID:options.googleAppID | ||
userDefaults:userDefaults]; | ||
|
||
FIRExperimentController *experimentController = [FIRExperimentController sharedInstance]; | ||
_configExperiment = [[RCNConfigExperiment alloc] initWithDBManager:_DBManager | ||
|
@@ -193,6 +194,21 @@ - (instancetype)initWithAppName:(NSString *)appName | |
return self; | ||
} | ||
|
||
- (instancetype)initWithAppName:(NSString *)appName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inject userDefaults for testing. This will be a single |
||
FIROptions:(FIROptions *)options | ||
namespace:(NSString *)FIRNamespace | ||
DBManager:(RCNConfigDBManager *)DBManager | ||
configContent:(RCNConfigContent *)configContent | ||
analytics:(nullable id<FIRAnalyticsInterop>)analytics { | ||
return [self initWithAppName:appName | ||
FIROptions:options | ||
namespace:FIRNamespace | ||
DBManager:DBManager | ||
configContent:configContent | ||
userDefaults:nil | ||
analytics:analytics]; | ||
} | ||
|
||
// Initialize with default config settings. | ||
- (void)setDefaultConfigSettings { | ||
// Set the default config settings. | ||
|
@@ -316,6 +332,8 @@ - (void)activateWithCompletion:(FIRRemoteConfigActivateChangeCompletion)completi | |
} | ||
// Check if the last fetched config has already been activated. Fetches with no data change are | ||
// ignored. | ||
NSLog(@"%f %f", strongSelf->_settings.lastETagUpdateTime, | ||
strongSelf->_settings.lastApplyTimeInterval); | ||
ncooke3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (strongSelf->_settings.lastETagUpdateTime == 0 || | ||
strongSelf->_settings.lastETagUpdateTime <= strongSelf->_settings.lastApplyTimeInterval) { | ||
FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000069", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
@class RCNConfigDBManager; | ||
|
||
/// This internal class contains a set of variables that are unique among all the config instances. | ||
/// It also handles all metadata and internal metadata. This class is not thread safe and does not | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Internal metadata handling was dead code. See #14153 |
||
/// It also handles all metadata. This class is not thread safe and does not | ||
/// inherently allow for synchronized access. Callers are responsible for synchronization | ||
/// (currently using serial dispatch queues). | ||
@interface RCNConfigSettings : NSObject | ||
|
@@ -55,11 +55,6 @@ | |
/// Custom variable (aka App context digest). This is the pending custom variables request before | ||
/// fetching. | ||
@property(nonatomic, copy) NSDictionary *customVariables; | ||
/// Cached internal metadata from internal metadata table. It contains customized information such | ||
/// as HTTP connection timeout, HTTP read timeout, success/failure throttling rate and time | ||
/// interval. Client has the default value of each parameters, they are only saved in | ||
/// internalMetadata if they have been customize by developers. | ||
@property(nonatomic, readonly, copy) NSDictionary *internalMetadata; | ||
/// Device conditions since last successful fetch from the backend. Device conditions including | ||
/// app | ||
/// version, iOS version, device localte, language, GMP project ID and Game project ID. Used for | ||
|
@@ -113,17 +108,20 @@ | |
firebaseAppName:(NSString *)appName | ||
googleAppID:(NSString *)googleAppID; | ||
|
||
- (instancetype)initWithDatabaseManager:(RCNConfigDBManager *)manager | ||
namespace:(NSString *)FIRNamespace | ||
firebaseAppName:(NSString *)appName | ||
googleAppID:(NSString *)googleAppID | ||
userDefaults:(NSUserDefaults *)userDefaults; | ||
|
||
/// Returns a fetch request with the latest device and config change. | ||
/// Whenever user issues a fetch api call, collect the latest request. | ||
/// @param userProperties User properties to set to config request. | ||
/// @return Config fetch request string | ||
- (NSString *)nextRequestWithUserProperties:(NSDictionary *)userProperties; | ||
|
||
/// Returns metadata from metadata table. | ||
- (NSDictionary *)loadConfigFromMetadataTable; | ||
|
||
/// Updates internal content with the latest successful config response. | ||
- (void)updateInternalContentWithResponse:(NSDictionary *)response; | ||
- (void)loadConfigFromMetadataTable; | ||
|
||
/// Updates the metadata table with the current fetch status. | ||
/// @param fetchSuccess True if fetch was successful. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No SPM while using ObjC unit tests in transition