"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-5079/ios/app/src/ViewController.m" (17 Jun 2021, 4240 Bytes) of package /linux/misc/jitsi-meet-5079.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 <Availability.h>
   19 
   20 @import CoreSpotlight;
   21 @import MobileCoreServices;
   22 @import Intents;  // Needed for NSUserActivity suggestedInvocationPhrase
   23 
   24 @import JitsiMeetSDK;
   25 
   26 #import "Types.h"
   27 #import "ViewController.h"
   28 
   29 
   30 @implementation ViewController
   31 
   32 - (void)viewDidLoad {
   33     [super viewDidLoad];
   34 
   35     JitsiMeetView *view = (JitsiMeetView *) self.view;
   36     view.delegate = self;
   37 
   38     [view join:[[JitsiMeet sharedInstance] getInitialConferenceOptions]];
   39 }
   40 
   41 // JitsiMeetViewDelegate
   42 
   43 - (void)_onJitsiMeetViewDelegateEvent:(NSString *)name
   44                              withData:(NSDictionary *)data {
   45     NSLog(
   46         @"[%s:%d] JitsiMeetViewDelegate %@ %@",
   47         __FILE__, __LINE__, name, data);
   48 
   49 #if DEBUG
   50     NSAssert(
   51         [NSThread isMainThread],
   52         @"JitsiMeetViewDelegate %@ method invoked on a non-main thread",
   53         name);
   54 #endif
   55 }
   56 
   57 - (void)conferenceJoined:(NSDictionary *)data {
   58     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_JOINED" withData:data];
   59 
   60     // Register a NSUserActivity for this conference so it can be invoked as a
   61     // Siri shortcut. This is only supported in iOS >= 12.
   62 #ifdef __IPHONE_12_0
   63     if (@available(iOS 12.0, *)) {
   64       NSUserActivity *userActivity
   65         = [[NSUserActivity alloc] initWithActivityType:JitsiMeetConferenceActivityType];
   66 
   67       NSString *urlStr = data[@"url"];
   68       NSURL *url = [NSURL URLWithString:urlStr];
   69       NSString *conference = [url.pathComponents lastObject];
   70 
   71       userActivity.title = [NSString stringWithFormat:@"Join %@", conference];
   72       userActivity.suggestedInvocationPhrase = @"Join my Jitsi meeting";
   73       userActivity.userInfo = @{@"url": urlStr};
   74       [userActivity setEligibleForSearch:YES];
   75       [userActivity setEligibleForPrediction:YES];
   76       [userActivity setPersistentIdentifier:urlStr];
   77 
   78       // Subtitle
   79       CSSearchableItemAttributeSet *attributes
   80         = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeItem];
   81       attributes.contentDescription = urlStr;
   82       userActivity.contentAttributeSet = attributes;
   83 
   84       self.userActivity = userActivity;
   85       [userActivity becomeCurrent];
   86     }
   87 #endif
   88 
   89 }
   90 
   91 - (void)conferenceTerminated:(NSDictionary *)data {
   92     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_TERMINATED" withData:data];
   93 }
   94 
   95 - (void)conferenceWillJoin:(NSDictionary *)data {
   96     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_WILL_JOIN" withData:data];
   97 }
   98 
   99 #if 0
  100 - (void)enterPictureInPicture:(NSDictionary *)data {
  101     [self _onJitsiMeetViewDelegateEvent:@"ENTER_PICTURE_IN_PICTURE" withData:data];
  102 
  103 }
  104 #endif
  105 
  106 - (void)participantJoined:(NSDictionary *)data {
  107   NSLog(@"%@%@", @"Participant joined: ", data[@"participantId"]);
  108 }
  109 
  110 - (void)participantLeft:(NSDictionary *)data {
  111   NSLog(@"%@%@", @"Participant left: ", data[@"participantId"]);
  112 }
  113 
  114 - (void)audioMutedChanged:(NSDictionary *)data {
  115   NSLog(@"%@%@", @"Audio muted changed: ", data[@"muted"]);
  116 }
  117 
  118 - (void)endpointTextMessageReceived:(NSDictionary *)data {
  119   NSLog(@"%@%@", @"Endpoint text message received: ", data);
  120 }
  121 
  122 - (void)screenShareToggled:(NSDictionary *)data {
  123   NSLog(@"%@%@", @"Screen share toggled: ", data);
  124 }
  125 
  126 - (void)chatMessageReceived:(NSDictionary *)data {
  127     NSLog(@"%@%@", @"Chat message received: ", data);
  128 }
  129 
  130 - (void)chatToggled:(NSDictionary *)data {
  131   NSLog(@"%@%@", @"Chat toggled: ", data);
  132 }
  133 
  134 - (void)videoMutedChanged:(NSDictionary *)data {
  135   NSLog(@"%@%@", @"Video muted changed: ", data[@"muted"]);
  136 }
  137 
  138 #pragma mark - Helpers
  139 
  140 - (void)terminate {
  141     JitsiMeetView *view = (JitsiMeetView *) self.view;
  142     [view leave];
  143 }
  144 
  145 @end