|
21 | 21 | #import <FirebaseInAppMessaging/NSString+FIRInterlaceStrings.h>
|
22 | 22 |
|
23 | 23 | #import <FirebaseCore/FirebaseCore.h>
|
24 |
| -#import <FirebaseDynamicLinks/FirebaseDynamicLinks.h> |
25 | 24 |
|
26 | 25 | @interface FIRInAppMessaging (Testing)
|
27 | 26 | + (void)disableAutoBootstrapWithFIRApp;
|
@@ -65,53 +64,4 @@ - (BOOL)application:(UIApplication *)application
|
65 | 64 | return YES;
|
66 | 65 | }
|
67 | 66 |
|
68 |
| -- (BOOL)application:(UIApplication *)application |
69 |
| - continueUserActivity:(NSUserActivity *)userActivity |
70 |
| - restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *))restorationHandler { |
71 |
| - NSLog(@"handle page url %@", userActivity.webpageURL); |
72 |
| - BOOL handled = [[FIRDynamicLinks dynamicLinks] |
73 |
| - handleUniversalLink:userActivity.webpageURL |
74 |
| - completion:^(FIRDynamicLink *_Nullable dynamicLink, NSError *_Nullable error) { |
75 |
| - if (dynamicLink) { |
76 |
| - NSLog(@"dynamic link recognized with url as %@", dynamicLink.url.absoluteString); |
77 |
| - [self showDeepLink:dynamicLink.url.absoluteString forUrlType:@"universal link"]; |
78 |
| - } else { |
79 |
| - NSLog(@"error happened %@", error); |
80 |
| - } |
81 |
| - }]; |
82 |
| - return handled; |
83 |
| -} |
84 |
| - |
85 |
| -- (void)showDeepLink:(NSString *)url forUrlType:(NSString *)urlType { |
86 |
| - NSString *message = [NSString stringWithFormat:@"App wants to open a %@ : %@", urlType, url]; |
87 |
| - UIAlertController *alert = |
88 |
| - [UIAlertController alertControllerWithTitle:@"Deep link recognized" |
89 |
| - message:message |
90 |
| - preferredStyle:UIAlertControllerStyleAlert]; |
91 |
| - |
92 |
| - UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK" |
93 |
| - style:UIAlertActionStyleDefault |
94 |
| - handler:^(UIAlertAction *action){ |
95 |
| - }]; |
96 |
| - |
97 |
| - [alert addAction:defaultAction]; |
98 |
| - [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:alert |
99 |
| - animated:YES |
100 |
| - completion:nil]; |
101 |
| -} |
102 |
| - |
103 |
| -- (BOOL)application:(UIApplication *)app |
104 |
| - openURL:(NSURL *)url |
105 |
| - options:(NSDictionary<NSString *, id> *)options { |
106 |
| - return [self application:app openURL:url sourceApplication:@"source app" annotation:@{}]; |
107 |
| -} |
108 |
| - |
109 |
| -- (BOOL)application:(UIApplication *)application |
110 |
| - openURL:(NSURL *)url |
111 |
| - sourceApplication:(NSString *)sourceApplication |
112 |
| - annotation:(id)annotation { |
113 |
| - NSLog(@"handle link with custom scheme: %@", url.absoluteString); |
114 |
| - [self showDeepLink:url.absoluteString forUrlType:@"custom scheme url"]; |
115 |
| - return YES; |
116 |
| -} |
117 | 67 | @end
|
0 commit comments