19
19
#import " FirebaseABTesting/Sources/Private/FirebaseABTestingInternal.h"
20
20
#import " FirebaseCore/Extension/FirebaseCoreInternal.h"
21
21
#import " FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
22
- #import " FirebaseRemoteConfig/Sources/Private/RCNConfigFetch.h"
23
22
#import " FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
24
23
#import " FirebaseRemoteConfig/Sources/RCNConfigRealtime.h"
25
24
@@ -136,7 +135,8 @@ - (instancetype)initWithAppName:(NSString *)appName
136
135
DBManager : (RCNConfigDBManager *)DBManager
137
136
configContent : (RCNConfigContent *)configContent
138
137
userDefaults : (nullable NSUserDefaults *)userDefaults
139
- analytics : (nullable id <FIRAnalyticsInterop>)analytics {
138
+ analytics : (nullable id <FIRAnalyticsInterop>)analytics
139
+ configFetch : (nullable RCNConfigFetch *)configFetch {
140
140
self = [super init ];
141
141
if (self) {
142
142
_appName = appName;
@@ -160,14 +160,18 @@ - (instancetype)initWithAppName:(NSString *)appName
160
160
161
161
// Initialize with default config settings.
162
162
[self setDefaultConfigSettings ];
163
- _configFetch = [[RCNConfigFetch alloc ] initWithContent: _configContent
164
- DBManager: _DBManager
165
- settings: _settings
166
- analytics: analytics
167
- experiment: _configExperiment
168
- queue: _queue
169
- namespace: _FIRNamespace
170
- options: options];
163
+ if (configFetch) {
164
+ _configFetch = configFetch;
165
+ } else {
166
+ _configFetch = [[RCNConfigFetch alloc ] initWithContent: _configContent
167
+ DBManager: _DBManager
168
+ settings: _settings
169
+ analytics: analytics
170
+ experiment: _configExperiment
171
+ queue: _queue
172
+ namespace: _FIRNamespace
173
+ options: options];
174
+ }
171
175
172
176
_configRealtime = [[RCNConfigRealtime alloc ] init: _configFetch
173
177
settings: _settings
@@ -200,7 +204,8 @@ - (instancetype)initWithAppName:(NSString *)appName
200
204
DBManager: DBManager
201
205
configContent: configContent
202
206
userDefaults: nil
203
- analytics: analytics];
207
+ analytics: analytics
208
+ configFetch: nil ];
204
209
}
205
210
206
211
// Initialize with default config settings.
@@ -250,16 +255,18 @@ - (void)callListeners:(NSString *)key config:(NSDictionary *)config {
250
255
251
256
#pragma mark - fetch
252
257
253
- - (void )fetchWithCompletionHandler : (FIRRemoteConfigFetchCompletion)completionHandler {
258
+ - (void )fetchWithCompletionHandler : (void (^_Nullable)(FIRRemoteConfigFetchStatus status,
259
+ NSError *_Nullable error))completionHandler {
254
260
dispatch_async (_queue, ^{
255
261
[self fetchWithExpirationDuration: self ->_settings.minimumFetchInterval
256
262
completionHandler: completionHandler];
257
263
});
258
264
}
259
265
260
266
- (void )fetchWithExpirationDuration : (NSTimeInterval )expirationDuration
261
- completionHandler : (FIRRemoteConfigFetchCompletion)completionHandler {
262
- FIRRemoteConfigFetchCompletion completionHandlerCopy = nil ;
267
+ completionHandler : (void (^_Nullable)(FIRRemoteConfigFetchStatus status,
268
+ NSError *_Nullable error))completionHandler {
269
+ void (^completionHandlerCopy)(FIRRemoteConfigFetchStatus, NSError *_Nullable) = nil ;
263
270
if (completionHandler) {
264
271
completionHandlerCopy = [completionHandler copy ];
265
272
}
0 commit comments