From a04d757df8257cad618f92f5eb0042b2a8aed7f3 Mon Sep 17 00:00:00 2001 From: Alexander Heinrich Date: Fri, 1 Nov 2019 23:23:09 +0100 Subject: [PATCH 1/2] (fix): open always returns true also when app is not installed --- src/ios/APPEmailComposer.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ios/APPEmailComposer.m b/src/ios/APPEmailComposer.m index 2ec99763..669a196a 100644 --- a/src/ios/APPEmailComposer.m +++ b/src/ios/APPEmailComposer.m @@ -153,7 +153,7 @@ - (void) openURLFromProperties:(NSDictionary*)props [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { - [self execCallback]; + [self execCallback: success]; }]; }); } @@ -169,10 +169,15 @@ - (BOOL) canUseAppleMail:(NSString*) scheme /** * Invokes the callback without any parameter. */ -- (void) execCallback +- (void) execCallback { + [self execCallback:true]; +} + +- (void) execCallback:(BOOL)success { + CDVPluginResult *result = [CDVPluginResult - resultWithStatus:CDVCommandStatus_OK]; + resultWithStatus:CDVCommandStatus_OK messageAsBool:success]; [self.commandDelegate sendPluginResult:result callbackId:self.command.callbackId]; From f89d644ea0f6ad0cd16a9aefb309666b5cee61a2 Mon Sep 17 00:00:00 2001 From: Alexander Heinrich Date: Wed, 6 Nov 2019 23:26:33 +0100 Subject: [PATCH 2/2] add result for MFMailComposer --- src/ios/APPEmailComposer.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ios/APPEmailComposer.m b/src/ios/APPEmailComposer.m index 669a196a..01a15f68 100644 --- a/src/ios/APPEmailComposer.m +++ b/src/ios/APPEmailComposer.m @@ -115,7 +115,14 @@ - (void) mailComposeController:(MFMailComposeViewController*)controller { [controller dismissViewControllerAnimated:YES completion:NULL]; - [self execCallback]; + switch(result) { + case MFMailComposeResultSent: + [self execCallback:YES]; + case MFMailComposeResultSaved: + [self execCallback:YES]; + default: + [self execCallback:NO]; + } } #pragma mark - @@ -170,7 +177,7 @@ - (BOOL) canUseAppleMail:(NSString*) scheme * Invokes the callback without any parameter. */ - (void) execCallback { - [self execCallback:true]; + [self execCallback:NO]; } - (void) execCallback:(BOOL)success