Merge pull request #664 from Codeseer/master

iOS Dynamic Links now 'Survive' installation.
This commit is contained in:
Michael Diarmid 2017-12-04 21:48:32 +00:00 committed by GitHub
commit fd5ad26079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,8 @@ static void sendDynamicLink(NSURL *url, id sender) {
RCT_EXPORT_MODULE();
static NSURL *installLink;
- (id)init {
self = [super init];
if (self != nil) {
@ -51,6 +53,9 @@ RCT_EXPORT_MODULE();
}
+ (BOOL)handleLinkFromCustomSchemeURL:(NSURL *)url {
if(!installLink) {
installLink = url;
}
FIRDynamicLink *dynamicLink =
[[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
if (dynamicLink && dynamicLink.url) {
@ -124,7 +129,8 @@ RCT_EXPORT_METHOD(getInitialLink:(RCTPromiseResolveBlock)resolve rejecter:(RCTPr
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) {
NSURL* url = (NSURL*)self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
[self handleInitialLinkFromCustomSchemeURL:url resolver:resolve rejecter:reject];
} else if(installLink) {
[self handleInitialLinkFromCustomSchemeURL:installLink resolver:resolve rejecter:reject];
} else {
NSDictionary *userActivityDictionary =
self.bridge.launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];