@@ -236,27 +236,28 @@ - (void)fetchAndActivateWithCompletionHandler:
236
236
(FIRRemoteConfigFetchAndActivateCompletion)completionHandler {
237
237
__weak FIRRemoteConfig *weakSelf = self;
238
238
FIRRemoteConfigFetchCompletion fetchCompletion =
239
- ^(FIRRemoteConfigFetchStatus fetchStatus, NSError *error ) {
239
+ ^(FIRRemoteConfigFetchStatus fetchStatus, NSError *fetchError ) {
240
240
FIRRemoteConfig *strongSelf = weakSelf;
241
241
if (!strongSelf) {
242
242
return ;
243
243
}
244
244
// Fetch completed. We are being called on the main queue.
245
245
// 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);
260
261
}
261
262
};
262
263
[self fetchWithCompletionHandler: fetchCompletion];
0 commit comments