AppDelegate.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2017 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "AppDelegate.h"
  15. @import Firebase;
  16. @interface AppDelegate ()
  17. @end
  18. @implementation AppDelegate
  19. - (BOOL)application:(UIApplication *)application
  20. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  21. // Override point for customization after application launch.
  22. // uncomment the following line for disabling the auto startup
  23. // of the sdk
  24. // [FIRInAppMessaging inAppMessaging].automaticDataCollectionEnabled = @NO;
  25. [FIROptions defaultOptions].deepLinkURLScheme = @"com.google.InAppMessagingExampleiOS";
  26. [FIRApp configure];
  27. return YES;
  28. }
  29. - (BOOL)application:(UIApplication *)app
  30. openURL:(NSURL *)url
  31. options:(NSDictionary<NSString *, id> *)options {
  32. NSLog(@"called here 1");
  33. return [self application:app
  34. openURL:url
  35. sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
  36. annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
  37. }
  38. - (BOOL)application:(UIApplication *)application
  39. openURL:(NSURL *)url
  40. sourceApplication:(NSString *)sourceApplication
  41. annotation:(id)annotation {
  42. FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
  43. NSLog(@"called here with %@", dynamicLink);
  44. if (dynamicLink) {
  45. if (dynamicLink.url) {
  46. // Handle the deep link. For example, show the deep-linked content,
  47. // apply a promotional offer to the user's account or show customized onboarding view.
  48. // ...
  49. } else {
  50. // Dynamic link has empty deep link. This situation will happens if
  51. // Firebase Dynamic Links iOS SDK tried to retrieve pending dynamic link,
  52. // but pending link is not available for this device/App combination.
  53. // At this point you may display default onboarding view.
  54. }
  55. return YES;
  56. }
  57. return NO;
  58. }
  59. @end