14
14
* limitations under the License.
15
15
*/
16
16
17
- #import " FirebaseRemoteConfig/Sources/RCNConfigFetch.h"
17
+ #import " FirebaseRemoteConfig/Sources/Private/ RCNConfigFetch.h"
18
18
19
19
#import < FirebaseCore/FIRApp.h>
20
20
#import < FirebaseCore/FIRLogger.h>
66
66
// Deprecated error code previously from FirebaseCore
67
67
static const NSInteger FIRErrorCodeConfigFailed = -114 ;
68
68
69
- static RCNConfigFetcherTestBlock gGlobalTestBlock ;
70
-
71
69
#pragma mark - RCNConfig
72
70
73
71
@implementation RCNConfigFetch {
@@ -271,13 +269,7 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
271
269
272
270
FIRLogInfo (kFIRLoggerRemoteConfig , @" I-RCN000022" , @" Success to get iid : %@ ." ,
273
271
strongSelfQueue->_settings .configInstallationsIdentifier );
274
- [strongSelf
275
- getAnalyticsUserPropertiesWithCompletionHandler: ^(NSDictionary *userProperties) {
276
- dispatch_async (strongSelf->_lockQueue , ^{
277
- [strongSelf fetchWithUserProperties: userProperties
278
- completionHandler: completionHandler];
279
- });
280
- }];
272
+ [strongSelf doFetchCall: completionHandler];
281
273
});
282
274
}];
283
275
};
@@ -286,6 +278,14 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
286
278
[installations authTokenWithCompletion: installationsTokenHandler];
287
279
}
288
280
281
+ - (void )doFetchCall : (FIRRemoteConfigFetchCompletion)completionHandler {
282
+ [self getAnalyticsUserPropertiesWithCompletionHandler: ^(NSDictionary *userProperties) {
283
+ dispatch_async (self->_lockQueue , ^{
284
+ [self fetchWithUserProperties: userProperties completionHandler: completionHandler];
285
+ });
286
+ }];
287
+ }
288
+
289
289
- (void )getAnalyticsUserPropertiesWithCompletionHandler :
290
290
(FIRAInteropUserPropertiesCallback)completionHandler {
291
291
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000060" , @" Fetch with user properties completed." );
@@ -489,23 +489,13 @@ - (void)fetchWithUserProperties:(NSDictionary *)userProperties
489
489
});
490
490
};
491
491
492
- if (gGlobalTestBlock ) {
493
- gGlobalTestBlock (fetcherCompletion);
494
- return ;
495
- }
496
492
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000061" , @" Making remote config fetch." );
497
493
498
494
NSURLSessionDataTask *dataTask = [self URLSessionDataTaskWithContent: compressedContent
499
495
completionHandler: fetcherCompletion];
500
496
[dataTask resume ];
501
497
}
502
498
503
- + (void )setGlobalTestBlock : (RCNConfigFetcherTestBlock)block {
504
- FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000027" ,
505
- @" Set global test block for NSSessionFetcher, it will not fetch from server." );
506
- gGlobalTestBlock = [block copy ];
507
- }
508
-
509
499
- (NSString *)constructServerURL {
510
500
NSString *serverURLStr = [[NSString alloc ] initWithString: kServerURLDomain ];
511
501
serverURLStr = [serverURLStr stringByAppendingString: kServerURLVersion ];
0 commit comments