Skip to content

Commit

Permalink
Resolve some deprecation warnings in CordovaLib
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Jan 8, 2019
1 parent 00c893b commit 3f07ca0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,7 @@ + (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIW
// only allow-intent if it's a UIWebViewNavigationTypeLinkClicked (anchor tag) OR
// it's a UIWebViewNavigationTypeOther, and it's an internal link
if ([[self class] shouldOpenURLRequest:request navigationType:navigationType]){
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
// CB-11895; openURL with a single parameter is deprecated in iOS 10
// see https://useyourloaf.com/blog/openurl-deprecated-in-ios10
if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:url];
}
#else
// fall back if on older SDK
[[UIApplication sharedApplication] openURL:url];
#endif
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}

// consume the request (i.e. no error) if it wasn't handled above
Expand Down
10 changes: 5 additions & 5 deletions CordovaLib/Classes/Public/CDVAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N

// this happens while we are running ( in the background, or from within our own app )
// only valid if 40x-Info.plist specifies a protocol to handle
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
if (!url) {
return NO;
Expand All @@ -83,12 +83,12 @@ - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplic

[openURLData setValue:url forKey:@"url"];

if (sourceApplication) {
[openURLData setValue:sourceApplication forKey:@"sourceApplication"];
if (options[UIApplicationOpenURLOptionsSourceApplicationKey]) {
[openURLData setValue:options[UIApplicationOpenURLOptionsSourceApplicationKey] forKey:@"sourceApplication"];
}

if (annotation) {
[openURLData setValue:annotation forKey:@"annotation"];
if (options[UIApplicationOpenURLOptionsAnnotationKey]) {
[openURLData setValue:options[UIApplicationOpenURLOptionsAnnotationKey] forKey:@"annotation"];
}

// all plugins will get the notification, and their handlers will be called
Expand Down
10 changes: 0 additions & 10 deletions CordovaLib/Classes/Public/CDVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -601,16 +601,6 @@ - (void)didReceiveMemoryWarning
// Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload
{
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;

[CDVUserAgentUtil releaseLock:&_userAgentLockToken];

[super viewDidUnload];
}

#pragma mark CordovaCommands

- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
Expand Down

0 comments on commit 3f07ca0

Please sign in to comment.