Skip to content

Commit

Permalink
Merge pull request #870 from wowmaking/ios-fetch-fix
Browse files Browse the repository at this point in the history
iOS fetch method error resolving added
  • Loading branch information
soumak77 authored Sep 27, 2018
2 parents 923ebb5 + 0a56cde commit a92659a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/ios/FirebasePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,23 @@ - (void)fetch:(CDVInvokedUrlCommand *)command {
int expirationDuration = [[command.arguments objectAtIndex:0] intValue];

[remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
CDVPluginResult *pluginResult;
if (status == FIRRemoteConfigFetchStatusSuccess) {
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
} else {
[remoteConfig fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
CDVPluginResult *pluginResult;
if (status == FIRRemoteConfigFetchStatusSuccess) {
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}
}];
Expand Down

0 comments on commit a92659a

Please sign in to comment.