Skip to content

Commit

Permalink
iOS fetch method error resolving added
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb Volchetskiy committed Sep 25, 2018
1 parent 5176a4c commit 0a56cde
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 0a56cde

Please sign in to comment.