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.8KB

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