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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. // Apple rejected our app because they claim requiring a
  41. // Dropbox account for recording is not acceptable.
  42. #if DEBUG
  43. [builder setFeatureFlag:@"ios.recording.enabled" withBoolean:YES];
  44. #endif
  45. }];
  46. [jitsiMeet application:application didFinishLaunchingWithOptions:launchOptions];
  47. return YES;
  48. }
  49. #pragma mark Linking delegate methods
  50. - (BOOL)application:(UIApplication *)application
  51. continueUserActivity:(NSUserActivity *)userActivity
  52. restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *restorableObjects))restorationHandler {
  53. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  54. // 1. Attempt to handle Universal Links through Firebase in order to support
  55. // its Dynamic Links (which we utilize for the purposes of deferred deep
  56. // linking).
  57. BOOL handled
  58. = [[FIRDynamicLinks dynamicLinks]
  59. handleUniversalLink:userActivity.webpageURL
  60. completion:^(FIRDynamicLink * _Nullable dynamicLink, NSError * _Nullable error) {
  61. NSURL *firebaseUrl = [FIRUtilities extractURL:dynamicLink];
  62. if (firebaseUrl != nil) {
  63. userActivity.webpageURL = firebaseUrl;
  64. [[JitsiMeet sharedInstance] application:application
  65. continueUserActivity:userActivity
  66. restorationHandler:restorationHandler];
  67. }
  68. }];
  69. if (handled) {
  70. return handled;
  71. }
  72. }
  73. // 2. Default to plain old, non-Firebase-assisted Universal Links.
  74. return [[JitsiMeet sharedInstance] application:application
  75. continueUserActivity:userActivity
  76. restorationHandler:restorationHandler];
  77. }
  78. - (BOOL)application:(UIApplication *)app
  79. openURL:(NSURL *)url
  80. options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  81. // This shows up during a reload in development, skip it.
  82. // https://github.com/firebase/firebase-ios-sdk/issues/233
  83. if ([[url absoluteString] containsString:@"google/link/?dismiss=1&is_weak_match=1"]) {
  84. return NO;
  85. }
  86. NSURL *openUrl = url;
  87. if ([FIRUtilities appContainsRealServiceInfoPlist]) {
  88. // Process Firebase Dynamic Links
  89. FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];
  90. NSURL *firebaseUrl = [FIRUtilities extractURL:dynamicLink];
  91. if (firebaseUrl != nil) {
  92. openUrl = firebaseUrl;
  93. }
  94. }
  95. return [[JitsiMeet sharedInstance] application:app
  96. openURL:openUrl
  97. options:options];
  98. }
  99. @end