-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[Linking] add Universal Links support to Linking.getInitialURL(). Fixes #6099 #6147
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
Conversation
By analyzing the blame information on this pull request, we identified @nicklockwood, @tadeuzagallo and @deminoth to be potential reviewers. |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
} else if (_bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]) { | ||
NSDictionary * userActivityDictionary = _bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; | ||
|
||
if ([(NSString *)userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqualToString:NSUserActivityTypeBrowsingWeb]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to cast, just use isEqual
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@daesan updated the pull request. |
} else if (_bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]) { | ||
NSDictionary *userActivityDictionary = _bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; | ||
|
||
if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqualToString:NSUserActivityTypeBrowsingWeb]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use isEqual:, which is defined on NSObject. If the object you get there is not a string, isEqualToString:
will crash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got you.
@daesan updated the pull request. |
NSDictionary *userActivityDictionary = _bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey]; | ||
|
||
if ([userActivityDictionary[UIApplicationLaunchOptionsUserActivityTypeKey] isEqual:NSUserActivityTypeBrowsingWeb]) { | ||
initialURL = ((NSUserActivity *)userActivityDictionary[@"UIApplicationLaunchOptionsUserActivityKey"]).webpageURL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the key defined in UIKit for this instead of the string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, UIApplicationLaunchOptionsUserActivityKey is not documented in Apple API docs and constant UIApplicationLaunchOptionsUserActivityKey is not being exported. The following URL is Apple API doc for launchOptions keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I was looking for a different key
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review. |
…k#6099 Summary:Currently, Linking.getInitialURL() only supports custom URL scheme and not Universal Links. This PR fixes that. see facebook#6099 Closes facebook#6147 Differential Revision: D2976902 Pulled By: javache fb-gh-sync-id: 750fe4a7c251ba57433c3a24866a4a510f125069 shipit-source-id: 750fe4a7c251ba57433c3a24866a4a510f125069
Currently, Linking.getInitialURL() only supports custom URL scheme and not Universal Links. This PR fixes that. see #6099