You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AppDelegate.m 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright @ 2018-present 8x8, Inc.
  3. * Copyright @ 2017-2018 Atlassian Pty Ltd
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #import "AppDelegate.h"
  18. #import "FIRUtilities.h"
  19. #import <JitsiMeet/JitsiMeet.h>
  20. @import Crashlytics;
  21. @import Fabric;
  22. @import Firebase;
  23. @implementation AppDelegate
  24. - (BOOL)application:(UIApplication *)application
  25. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  26. // Initialize Crashlytics and Firebase if a valid GoogleService-Info.plist file was provided.
  27. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  28. NSLog(@"Enablign Crashlytics and Firebase");
  29. [FIRApp configure];
  30. [Fabric with:@[[Crashlytics class]]];
  31. }
  32. return [JitsiMeetView application:application
  33. didFinishLaunchingWithOptions:launchOptions];
  34. }
  35. #pragma mark Linking delegate methods
  36. - (BOOL)application:(UIApplication *)application
  37. continueUserActivity:(NSUserActivity *)userActivity
  38. restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler {
  39. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  40. // 1. Attempt to handle Universal Links through Firebase in order to support
  41. // its Dynamic Links (which we utilize for the purposes of deferred deep
  42. // linking).
  43. BOOL handled
  44. = [[FIRDynamicLinks dynamicLinks]
  45. handleUniversalLink:userActivity.webpageURL
  46. completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) {
  47. NSURL *dynamicLinkURL = dynamicLink.url;
  48. if (dynamicLinkURL) {
  49. userActivity.webpageURL = dynamicLinkURL;
  50. [JitsiMeetView application:application
  51. continueUserActivity:userActivity
  52. restorationHandler:restorationHandler];
  53. }
  54. }];
  55. if (handled) {
  56. return handled;
  57. }
  58. }
  59. // 2. Default to plain old, non-Firebase-assisted Universal Links.
  60. return [JitsiMeetView application:application
  61. continueUserActivity:userActivity
  62. restorationHandler:restorationHandler];
  63. }
  64. - (BOOL)application:(UIApplication *)app
  65. openURL:(NSURL *)url
  66. options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  67. NSURL *openUrl = url;
  68. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  69. // Process Firebase Dynamic Links
  70. FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
  71. if (dynamicLink != nil) {
  72. NSURL *dynamicLinkURL = dynamicLink.url;
  73. if (dynamicLinkURL != nil
  74. && (dynamicLink.matchType == FIRDLMatchTypeUnique
  75. || dynamicLink.matchType == FIRDLMatchTypeDefault)) {
  76. // Strong match, process it.
  77. openUrl = dynamicLinkURL;
  78. }
  79. }
  80. }
  81. return [JitsiMeetView application:app
  82. openURL:openUrl
  83. options:options];
  84. }
  85. @end