"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-4445/ios/app/src/AppDelegate.m" (30 Sep 2020, 5018 Bytes) of package /linux/misc/jitsi-meet-4445.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.

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