"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7309/ios/app/src/ViewController.m" (31 May 2023, 4148 Bytes) of package /linux/misc/jitsi-meet-7309.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 @ 2017-present 8x8, Inc.
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  *     http://www.apache.org/licenses/LICENSE-2.0
    9  *
   10  * Unless required by applicable law or agreed to in writing, software
   11  * distributed under the License is distributed on an "AS IS" BASIS,
   12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13  * See the License for the specific language governing permissions and
   14  * limitations under the License.
   15  */
   16 
   17 @import CoreSpotlight;
   18 @import MobileCoreServices;
   19 @import Intents;  // Needed for NSUserActivity suggestedInvocationPhrase
   20 
   21 @import JitsiMeetSDK;
   22 
   23 #import "Types.h"
   24 #import "ViewController.h"
   25 
   26 
   27 @implementation ViewController
   28 
   29 - (void)viewDidLoad {
   30     [super viewDidLoad];
   31 
   32     JitsiMeetView *view = (JitsiMeetView *) self.view;
   33     view.delegate = self;
   34 
   35     [view join:[[JitsiMeet sharedInstance] getInitialConferenceOptions]];
   36 }
   37 
   38 // JitsiMeetViewDelegate
   39 
   40 - (void)_onJitsiMeetViewDelegateEvent:(NSString *)name
   41                              withData:(NSDictionary *)data {
   42     NSLog(
   43         @"[%s:%d] JitsiMeetViewDelegate %@ %@",
   44         __FILE__, __LINE__, name, data);
   45 
   46 #if DEBUG
   47     NSAssert(
   48         [NSThread isMainThread],
   49         @"JitsiMeetViewDelegate %@ method invoked on a non-main thread",
   50         name);
   51 #endif
   52 }
   53 
   54 - (void)conferenceJoined:(NSDictionary *)data {
   55     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_JOINED" withData:data];
   56 
   57     // Register a NSUserActivity for this conference so it can be invoked as a
   58     // Siri shortcut.
   59     NSUserActivity *userActivity
   60       = [[NSUserActivity alloc] initWithActivityType:JitsiMeetConferenceActivityType];
   61 
   62     NSString *urlStr = data[@"url"];
   63     NSURL *url = [NSURL URLWithString:urlStr];
   64     NSString *conference = [url.pathComponents lastObject];
   65 
   66     userActivity.title = [NSString stringWithFormat:@"Join %@", conference];
   67     userActivity.suggestedInvocationPhrase = @"Join my Jitsi meeting";
   68     userActivity.userInfo = @{@"url": urlStr};
   69     [userActivity setEligibleForSearch:YES];
   70     [userActivity setEligibleForPrediction:YES];
   71     [userActivity setPersistentIdentifier:urlStr];
   72 
   73     // Subtitle
   74     CSSearchableItemAttributeSet *attributes
   75       = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeItem];
   76     attributes.contentDescription = urlStr;
   77     userActivity.contentAttributeSet = attributes;
   78 
   79     self.userActivity = userActivity;
   80     [userActivity becomeCurrent];
   81 }
   82 
   83 - (void)conferenceTerminated:(NSDictionary *)data {
   84     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_TERMINATED" withData:data];
   85 }
   86 
   87 - (void)conferenceWillJoin:(NSDictionary *)data {
   88     [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_WILL_JOIN" withData:data];
   89 }
   90 
   91 #if 0
   92 - (void)enterPictureInPicture:(NSDictionary *)data {
   93     [self _onJitsiMeetViewDelegateEvent:@"ENTER_PICTURE_IN_PICTURE" withData:data];
   94 }
   95 #endif
   96 
   97 - (void)readyToClose:(NSDictionary *)data {
   98     [self _onJitsiMeetViewDelegateEvent:@"READY_TO_CLOSE" withData:data];
   99 }
  100 
  101 - (void)participantJoined:(NSDictionary *)data {
  102   NSLog(@"%@%@", @"Participant joined: ", data[@"participantId"]);
  103 }
  104 
  105 - (void)participantLeft:(NSDictionary *)data {
  106   NSLog(@"%@%@", @"Participant left: ", data[@"participantId"]);
  107 }
  108 
  109 - (void)audioMutedChanged:(NSDictionary *)data {
  110   NSLog(@"%@%@", @"Audio muted changed: ", data[@"muted"]);
  111 }
  112 
  113 - (void)endpointTextMessageReceived:(NSDictionary *)data {
  114   NSLog(@"%@%@", @"Endpoint text message received: ", data);
  115 }
  116 
  117 - (void)screenShareToggled:(NSDictionary *)data {
  118   NSLog(@"%@%@", @"Screen share toggled: ", data);
  119 }
  120 
  121 - (void)chatMessageReceived:(NSDictionary *)data {
  122     NSLog(@"%@%@", @"Chat message received: ", data);
  123 }
  124 
  125 - (void)chatToggled:(NSDictionary *)data {
  126   NSLog(@"%@%@", @"Chat toggled: ", data);
  127 }
  128 
  129 - (void)videoMutedChanged:(NSDictionary *)data {
  130   NSLog(@"%@%@", @"Video muted changed: ", data[@"muted"]);
  131 }
  132 
  133 #pragma mark - Helpers
  134 
  135 - (void)terminate {
  136     JitsiMeetView *view = (JitsiMeetView *) self.view;
  137     [view leave];
  138 }
  139 
  140 @end