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

fix(ios): guard source property and removed NSNull if it is nil #11242

Merged
merged 5 commits into from
Oct 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,12 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction
[launchOptions setObject:[url absoluteString] forKey:@"url"];
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];

[launchOptions setObject:[options objectForKey:UIApplicationOpenURLOptionsSourceApplicationKey] ?: [NSNull null] forKey:@"source"];
id source = [options objectForKey:UIApplicationOpenURLOptionsSourceApplicationKey];
if (source != nil) {
[launchOptions setObject:source forKey:@"source"];
} else {
[launchOptions removeObjectForKey:@"source"];
}

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiApplicationLaunchedFromURL object:self userInfo:launchOptions];
Expand All @@ -453,7 +458,11 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
[launchOptions setObject:[url absoluteString] forKey:@"url"];
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];

[launchOptions setObject:sourceApplication ?: [NSNull null] forKey:@"source"];
if (sourceApplication != nil) {
[launchOptions setObject:sourceApplication forKey:@"source"];
} else {
[launchOptions removeObjectForKey:@"source"];
}

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiApplicationLaunchedFromURL object:self userInfo:launchOptions];
Expand Down