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 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 "Types.h"
  20. @import Crashlytics;
  21. @import Fabric;
  22. @import Firebase;
  23. @import JitsiMeet;
  24. @implementation AppDelegate
  25. - (BOOL)application:(UIApplication *)application
  26. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  27. // Initialize Crashlytics and Firebase if a valid GoogleService-Info.plist file was provided.
  28. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  29. NSLog(@"Enablign Crashlytics and Firebase");
  30. [FIRApp configure];
  31. [Fabric with:@[[Crashlytics class]]];
  32. }
  33. JitsiMeet *jitsiMeet = [JitsiMeet sharedInstance];
  34. jitsiMeet.conferenceActivityType = JitsiMeetConferenceActivityType;
  35. jitsiMeet.customUrlScheme = @"org.jitsi.meet";
  36. jitsiMeet.universalLinkDomains = @[@"meet.jit.si", @"alpha.jitsi.net", @"beta.meet.jit.si"];
  37. jitsiMeet.defaultConferenceOptions = [JitsiMeetConferenceOptions fromBuilder:^(JitsiMeetConferenceOptionsBuilder *builder) {
  38. builder.serverURL = [NSURL URLWithString:@"https://meet.jit.si"];
  39. builder.welcomePageEnabled = YES;
  40. }];
  41. [jitsiMeet application:application didFinishLaunchingWithOptions:launchOptions];
  42. return YES;
  43. }
  44. #pragma mark Linking delegate methods
  45. - (BOOL)application:(UIApplication *)application
  46. continueUserActivity:(NSUserActivity *)userActivity
  47. restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler {
  48. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  49. // 1. Attempt to handle Universal Links through Firebase in order to support
  50. // its Dynamic Links (which we utilize for the purposes of deferred deep
  51. // linking).
  52. BOOL handled
  53. = [[FIRDynamicLinks dynamicLinks]
  54. handleUniversalLink:userActivity.webpageURL
  55. completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) {
  56. NSURL *firebaseUrl = [FIRUtilities extractURL:dynamicLink];
  57. if (firebaseUrl != nil) {
  58. userActivity.webpageURL = firebaseUrl;
  59. [[JitsiMeet sharedInstance] application:application
  60. continueUserActivity:userActivity
  61. restorationHandler:restorationHandler];
  62. }
  63. }];
  64. if (handled) {
  65. return handled;
  66. }
  67. }
  68. // 2. Default to plain old, non-Firebase-assisted Universal Links.
  69. return [[JitsiMeet sharedInstance] application:application
  70. continueUserActivity:userActivity
  71. restorationHandler:restorationHandler];
  72. }
  73. - (BOOL)application:(UIApplication *)app
  74. openURL:(NSURL *)url
  75. options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  76. // This shows up during a reload in development, skip it.
  77. // https://github.com/firebase/firebase-ios-sdk/issues/233
  78. if ([[url absoluteString] containsString:@"google/link/?dismiss=1&is_weak_match=1"]) {
  79. return NO;
  80. }
  81. NSURL *openUrl = url;
  82. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  83. // Process Firebase Dynamic Links
  84. FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
  85. NSURL *firebaseUrl = [FIRUtilities extractURL:dynamicLink];
  86. if (firebaseUrl != nil) {
  87. openUrl = firebaseUrl;
  88. }
  89. }
  90. return [[JitsiMeet sharedInstance] application:app
  91. openURL:openUrl
  92. options:options];
  93. }
  94. @end