From 5cc4150149590ebd1731bfdf570b8ebc8ba92579 Mon Sep 17 00:00:00 2001 From: Eldhose M Babu Date: Wed, 21 Oct 2020 14:53:24 -0700 Subject: [PATCH] Fixed broken callback to AppDelegate (#6800) Fixed broken callback to AppDelegate after retrieving a dynamic link during fresh app start. The AppDelegate call was broken in PR : #6517 Reverting to the old implementation of dynamic link passing to App delegate with changes to remove iOS 9 checks. Using new "openURL" method instead of the deprecated one. Clean up in the sample app pod file. --- FirebaseDynamicLinks/Sources/FIRDynamicLinks.m | 9 +++++++++ FirebaseDynamicLinks/Tests/Sample/Podfile | 14 +++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m b/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m index f7a8322085e..acd5665e21a 100644 --- a/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m +++ b/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m @@ -509,6 +509,15 @@ - (BOOL)handleIncomingCustomSchemeDeepLink:(NSURL *)url { } - (void)passRetrievedDynamicLinkToApplication:(NSURL *)url { + id applicationDelegate = [UIApplication sharedApplication].delegate; + if (applicationDelegate && + [applicationDelegate respondsToSelector:@selector(application:openURL:options:)]) { + // pass url directly to application delegate to avoid hop into + // iOS handling of the universal links + [applicationDelegate application:[UIApplication sharedApplication] openURL:url options:@{}]; + return; + } + [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } diff --git a/FirebaseDynamicLinks/Tests/Sample/Podfile b/FirebaseDynamicLinks/Tests/Sample/Podfile index d56705a812d..57375341202 100644 --- a/FirebaseDynamicLinks/Tests/Sample/Podfile +++ b/FirebaseDynamicLinks/Tests/Sample/Podfile @@ -1,14 +1,10 @@ -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - target 'FDLBuilderTestAppObjC' do - # Comment the next line if you don't want to use dynamic frameworks + platform :ios, '10.0' use_frameworks! - pod 'FirebaseAnalytics' + pod 'FirebaseCore', :path => '../../../' - pod 'FirebaseInstallations', :path => '../../../' - pod 'FirebaseInstanceID', :path => '../../../' - pod 'FirebaseDynamicLinks', :path => '../../../' + pod 'FirebaseCoreDiagnostics', :path => '../../../' + pod 'GoogleDataTransport', :path => '../../../' pod 'GoogleUtilities', :path => '../../../' - + pod 'FirebaseDynamicLinks', :path => '../../../' end