diff --git a/package-lock.json b/package-lock.json index 5e8b07041..8fa4f3937 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-inappbrowser", - "version": "5.0.20-hogangnono", + "version": "5.0.24-hogangnono-dev", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0e79678a4..f8d1d45e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-inappbrowser", - "version": "5.0.20-hogangnono", + "version": "5.0.24-hogangnono-dev", "description": "Cordova InAppBrowser Plugin", "types": "./types/index.d.ts", "cordova": { diff --git a/plugin.xml b/plugin.xml index 78fe2b1c9..6ae6422bd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="5.0.24-hogangnono-dev"> InAppBrowser Cordova InAppBrowser Plugin diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 514597024..d380fb2fc 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -366,10 +366,11 @@ - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options - (void)openInSystem:(NSURL*)url { - if ([[UIApplication sharedApplication] openURL:url] == NO) { - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; - [[UIApplication sharedApplication] openURL:url]; - } + [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { + if (!success) { + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; + } + }]; } - (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command diff --git a/src/ios/SVWebViewControllerActivityChrome.m b/src/ios/SVWebViewControllerActivityChrome.m index ebe672c49..142e9f761 100755 --- a/src/ios/SVWebViewControllerActivityChrome.m +++ b/src/ios/SVWebViewControllerActivityChrome.m @@ -46,7 +46,7 @@ - (void)performActivity { NSURL *chromeURL = [NSURL URLWithString:chromeURLString]; // Open the URL with Chrome. - [[UIApplication sharedApplication] openURL:chromeURL]; + [[UIApplication sharedApplication] openURL:chromeURL options:@{} completionHandler:nil]; } } diff --git a/src/ios/SVWebViewControllerActivitySafari.m b/src/ios/SVWebViewControllerActivitySafari.m index f569fe3e6..416741022 100755 --- a/src/ios/SVWebViewControllerActivitySafari.m +++ b/src/ios/SVWebViewControllerActivitySafari.m @@ -25,8 +25,9 @@ - (BOOL)canPerformWithActivityItems:(NSArray *)activityItems { } - (void)performActivity { - BOOL completed = [[UIApplication sharedApplication] openURL:self.URLToOpen]; - [self activityDidFinish:completed]; + [[UIApplication sharedApplication] openURL:self.URLToOpen options:@{} completionHandler:^(BOOL success) { + [self activityDidFinish:success]; + }]; } @end diff --git a/src/osx/CDVInAppBrowser.m b/src/osx/CDVInAppBrowser.m deleted file mode 100644 index 9d579e152..000000000 --- a/src/osx/CDVInAppBrowser.m +++ /dev/null @@ -1,89 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - */ - -#import "CDVInAppBrowser.h" -#import - -#define kInAppBrowserTargetSelf @"_self" -#define kInAppBrowserTargetSystem @"_system" -#define kInAppBrowserTargetBlank @"_blank" - -@interface CDVInAppBrowser () { -} -@end - -@implementation CDVInAppBrowser - -- (void)pluginInitialize -{ -} - -- (BOOL) isSystemUrl:(NSURL*)url -{ - if ([[url host] isEqualToString:@"itunes.apple.com"]) { - return YES; - } - - return NO; -} - -- (void)open:(CDVInvokedUrlCommand*)command -{ - CDVPluginResult* pluginResult; - - NSString* url = [command argumentAtIndex:0]; - NSString* target = [command argumentAtIndex:1 withDefault:kInAppBrowserTargetSelf]; - - self.callbackId = command.callbackId; - - if (url != nil) { - - NSURL* baseUrl = [NSURL URLWithString:url]; - - NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL]; - - if ([self isSystemUrl:absoluteUrl]) { - target = kInAppBrowserTargetSystem; - } - - if ([target isEqualToString:kInAppBrowserTargetSelf]) { - //[self openInCordovaWebView:absoluteUrl withOptions:options]; - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not Yet Implemented for OSX: [self openInCordovaWebView:absoluteUrl withOptions:options]"]; - } else if ([target isEqualToString:kInAppBrowserTargetSystem]) { - [self openInSystem:absoluteUrl]; - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; - } else { // _blank or anything else - //[self openInInAppBrowser:absoluteUrl withOptions:options]; - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not Yet Implemented for OSX: [self openInInAppBrowser:absoluteUrl withOptions:options]"]; - } - - } else { - pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"incorrect number of arguments"]; - } - [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; -} - -- (void)openInSystem:(NSURL*)url -{ - [[NSWorkspace sharedWorkspace] openURL:url]; -} - -@end -