@@ -236,27 +236,28 @@ - (void)fetchAndActivateWithCompletionHandler:
236236 (FIRRemoteConfigFetchAndActivateCompletion)completionHandler {
237237 __weak FIRRemoteConfig *weakSelf = self;
238238 FIRRemoteConfigFetchCompletion fetchCompletion =
239- ^(FIRRemoteConfigFetchStatus fetchStatus, NSError *error ) {
239+ ^(FIRRemoteConfigFetchStatus fetchStatus, NSError *fetchError ) {
240240 FIRRemoteConfig *strongSelf = weakSelf;
241241 if (!strongSelf) {
242242 return ;
243243 }
244244 // Fetch completed. We are being called on the main queue.
245245 // If fetch is successful, try to activate the fetched config
246- bool didActivate = false ;
247- if (fetchStatus == FIRRemoteConfigFetchStatusSuccess && !error) {
248- didActivate = [strongSelf activateFetched ];
249- }
250- if (completionHandler) {
251- FIRRemoteConfigFetchAndActivateStatus status = FIRRemoteConfigFetchAndActivateStatusError;
252- if (fetchStatus == FIRRemoteConfigFetchStatusSuccess) {
253- status = didActivate ? FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote
254- : FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
255- } else {
256- status = FIRRemoteConfigFetchAndActivateStatusError;
257- }
258- // Pass along the fetch error e.g. throttled.
259- completionHandler (status, error);
246+ if (fetchStatus == FIRRemoteConfigFetchStatusSuccess && !fetchError) {
247+ [strongSelf activateWithCompletionHandler: ^(NSError *_Nullable activateError) {
248+ if (completionHandler) {
249+ FIRRemoteConfigFetchAndActivateStatus status =
250+ activateError ? FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData
251+ : FIRRemoteConfigFetchAndActivateStatusSuccessFetchedFromRemote;
252+ completionHandler (status, nil );
253+ }
254+ }];
255+ } else if (completionHandler) {
256+ FIRRemoteConfigFetchAndActivateStatus status =
257+ fetchStatus == FIRRemoteConfigFetchStatusSuccess
258+ ? FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData
259+ : FIRRemoteConfigFetchAndActivateStatusError;
260+ completionHandler (status, fetchError);
260261 }
261262 };
262263 [self fetchWithCompletionHandler: fetchCompletion];
0 commit comments