Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding ios 10 support #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/ios/Launcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,24 @@ - (void)launch:(CDVInvokedUrlCommand*)command {
NSString *uri = [options objectForKey:@"uri"];
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:uri]]) {
NSURL *launchURL = [NSURL URLWithString:uri];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
[[UIApplication sharedApplication] openURL:launchURL options:@{} completionHandler:^(BOOL success) {
CDVPluginResult * pluginResult = nil;
if (success) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
else
{
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No app installed that can handle that uri."];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}];
#else
[[UIApplication sharedApplication] openURL: launchURL];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
#endif
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No app installed that can handle that uri."];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
Expand All @@ -42,5 +57,4 @@ - (void)launch:(CDVInvokedUrlCommand*)command {
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}

@end
@end