"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-6193/ios/app/src/AppDelegate.m" (20 May 2022, 5127 Bytes) of package /linux/misc/jitsi-meet-6193.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Matlab source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "AppDelegate.m": jitsi-meet_7001_vs_jitsi-meet_7210.

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