"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7319/ios/sdk/src/ScheenshareEventEmiter.m" (6 Jun 2023, 2953 Bytes) of package /linux/misc/jitsi-meet-7319.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 @ 2021-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 "ScheenshareEventEmiter.h"
18 #import "JitsiMeet+Private.h"
19 #import "ExternalAPI.h"
20
21 NSNotificationName const kBroadcastStartedNotification = @"iOS_BroadcastStarted";
22 NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped";
23
24 @implementation ScheenshareEventEmiter {
25 CFNotificationCenterRef _notificationCenter;
26 }
27
28 - (instancetype)init {
29 self = [super init];
30 if (self) {
31 _notificationCenter = CFNotificationCenterGetDarwinNotifyCenter();
32 [self setupObserver];
33 }
34
35 return self;
36 }
37
38 - (void)dealloc {
39 [self clearObserver];
40 }
41
42 // MARK: Private Methods
43
44 - (void)setupObserver {
45 CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStartedNotificationCallback, (__bridge CFStringRef)kBroadcastStartedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
46 CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStoppedNotificationCallback, (__bridge CFStringRef)kBroadcastStoppedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
47 }
48
49 - (void)clearObserver {
50 CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStartedNotification, NULL);
51 CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStoppedNotification, NULL);
52 }
53
54 void broadcastStartedNotificationCallback(CFNotificationCenterRef center,
55 void *observer,
56 CFStringRef name,
57 const void *object,
58 CFDictionaryRef userInfo) {
59 ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
60 [externalAPI toggleScreenShare:true];
61 }
62
63 void broadcastStoppedNotificationCallback(CFNotificationCenterRef center,
64 void *observer,
65 CFStringRef name,
66 const void *object,
67 CFDictionaryRef userInfo) {
68 ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
69 [externalAPI toggleScreenShare:false];
70 }
71
72 @end