1414 * limitations under the License.
1515 */
1616
17- #import " FirebaseRemoteConfig/Sources/RCNConfigFetch.h"
17+ #import " FirebaseRemoteConfig/Sources/Private/ RCNConfigFetch.h"
1818
1919#import < FirebaseCore/FIRApp.h>
2020#import < FirebaseCore/FIRLogger.h>
6666// Deprecated error code previously from FirebaseCore
6767static const NSInteger FIRErrorCodeConfigFailed = -114 ;
6868
69- static RCNConfigFetcherTestBlock gGlobalTestBlock ;
70-
7169#pragma mark - RCNConfig
7270
7371@implementation RCNConfigFetch {
@@ -271,13 +269,7 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
271269
272270 FIRLogInfo (kFIRLoggerRemoteConfig , @" I-RCN000022" , @" Success to get iid : %@ ." ,
273271 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];
281273 });
282274 }];
283275 };
@@ -286,6 +278,14 @@ - (void)refreshInstallationsTokenWithCompletionHandler:
286278 [installations authTokenWithCompletion: installationsTokenHandler];
287279}
288280
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+
289289- (void )getAnalyticsUserPropertiesWithCompletionHandler :
290290 (FIRAInteropUserPropertiesCallback)completionHandler {
291291 FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000060" , @" Fetch with user properties completed." );
@@ -489,23 +489,13 @@ - (void)fetchWithUserProperties:(NSDictionary *)userProperties
489489 });
490490 };
491491
492- if (gGlobalTestBlock ) {
493- gGlobalTestBlock (fetcherCompletion);
494- return ;
495- }
496492 FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000061" , @" Making remote config fetch." );
497493
498494 NSURLSessionDataTask *dataTask = [self URLSessionDataTaskWithContent: compressedContent
499495 completionHandler: fetcherCompletion];
500496 [dataTask resume ];
501497}
502498
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-
509499- (NSString *)constructServerURL {
510500 NSString *serverURLStr = [[NSString alloc ] initWithString: kServerURLDomain ];
511501 serverURLStr = [serverURLStr stringByAppendingString: kServerURLVersion ];
0 commit comments