Selaa lähdekoodia

fix(ios) fix leaving the meeting when screen-sharing

j8
Alex Bumbu 4 vuotta sitten
vanhempi
commit
cf37d34923

+ 4
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java Näytä tiedosto

@@ -20,8 +20,10 @@ public class BroadcastIntentHelper {
20 20
         return intent;
21 21
     }
22 22
 
23
-    public static Intent buildToggleScreenShareIntent() {
24
-        return new Intent(BroadcastAction.Type.TOGGLE_SCREEN_SHARE.getAction());
23
+    public static Intent buildToggleScreenShareIntent(boolean enabled) {
24
+        Intent intent = new Intent(BroadcastAction.Type.TOGGLE_SCREEN_SHARE.getAction());
25
+        intent.putExtra("enabled", enabled);
26
+        return intent;
25 27
     }
26 28
 
27 29
     public static Intent buildOpenChatIntent(String participantId) {

+ 1
- 1
ios/sdk/sdk.xcodeproj/project.pbxproj Näytä tiedosto

@@ -198,7 +198,6 @@
198 198
 				0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
199 199
 				C69EFA02209A0EFD0027712B /* callkit */,
200 200
 				A4A934E7212F3AB8001E9388 /* dropbox */,
201
-				0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
202 201
 				0BD906E91EC0C00300C8C18E /* Info.plist */,
203 202
 				DE438CD82350934700DD541D /* JavaScriptSandbox.m */,
204 203
 				0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
@@ -235,6 +234,7 @@
235 234
 				C8AFD27D2462C613000293D2 /* InfoPlistUtil.h */,
236 235
 				C8AFD27E2462C613000293D2 /* InfoPlistUtil.m */,
237 236
 				C81E9AB825AC5AD800B134D9 /* ExternalAPI.h */,
237
+				0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
238 238
 				4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */,
239 239
 				4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */,
240 240
 			);

+ 1
- 1
ios/sdk/src/ExternalAPI.h Näytä tiedosto

@@ -21,7 +21,7 @@
21 21
 - (void)sendHangUp;
22 22
 - (void)sendSetAudioMuted:(BOOL)muted;
23 23
 - (void)sendEndpointTextMessage:(NSString*)message :(NSString*)to;
24
-- (void)toggleScreenShare;
24
+- (void)toggleScreenShare:(BOOL)enabled;
25 25
 - (void)retrieveParticipantsInfo:(void (^)(NSArray*))completion;
26 26
 - (void)openChat:(NSString*)to;
27 27
 - (void)closeChat;

+ 5
- 2
ios/sdk/src/ExternalAPI.m Näytä tiedosto

@@ -164,8 +164,11 @@ RCT_EXPORT_METHOD(sendEvent:(NSString *)name
164 164
     [self sendEventWithName:sendEndpointTextMessageAction body:data];
165 165
 }
166 166
 
167
-- (void)toggleScreenShare {
168
-    [self sendEventWithName:toggleScreenShareAction body:nil];
167
+- (void)toggleScreenShare:(BOOL)enabled {
168
+    NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
169
+    data[@"enabled"] = [NSNumber numberWithBool:enabled];
170
+    
171
+    [self sendEventWithName:toggleScreenShareAction body:data];
169 172
 }
170 173
 
171 174
 - (void)retrieveParticipantsInfo:(void (^)(NSArray*))completionHandler {

+ 1
- 1
ios/sdk/src/JitsiMeetView.h Näytä tiedosto

@@ -39,7 +39,7 @@
39 39
 - (void)hangUp;
40 40
 - (void)setAudioMuted:(BOOL)muted;
41 41
 - (void)sendEndpointTextMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to;
42
-- (void)toggleScreenShare;
42
+- (void)toggleScreenShare:(BOOL)enabled;
43 43
 - (void)retrieveParticipantsInfo:(void (^ _Nonnull)(NSArray * _Nullable))completionHandler;
44 44
 - (void)openChat:(NSString * _Nullable)to;
45 45
 - (void)closeChat;

+ 2
- 2
ios/sdk/src/JitsiMeetView.m Näytä tiedosto

@@ -130,9 +130,9 @@ static void initializeViewsMap() {
130 130
     [externalAPI sendEndpointTextMessage:message :to];
131 131
 }
132 132
 
133
-- (void)toggleScreenShare {
133
+- (void)toggleScreenShare:(BOOL)enabled {
134 134
     ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
135
-    [externalAPI toggleScreenShare];
135
+    [externalAPI toggleScreenShare:enabled];
136 136
 }
137 137
 
138 138
 - (void)retrieveParticipantsInfo:(void (^ _Nonnull)(NSArray * _Nullable))completionHandler {

+ 17
- 8
ios/sdk/src/ScheenshareEventEmiter.m Näytä tiedosto

@@ -42,8 +42,8 @@ NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped"
42 42
 // MARK: Private Methods
43 43
 
44 44
 - (void)setupObserver {
45
-    CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastToggleNotificationCallback, (__bridge CFStringRef)kBroadcastStartedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
46
-    CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastToggleNotificationCallback, (__bridge CFStringRef)kBroadcastStoppedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
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 47
 }
48 48
 
49 49
 - (void)clearObserver {
@@ -51,13 +51,22 @@ NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped"
51 51
     CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStoppedNotification, NULL);
52 52
 }
53 53
 
54
-void broadcastToggleNotificationCallback(CFNotificationCenterRef center,
55
-                                         void *observer,
56
-                                         CFStringRef name,
57
-                                         const void *object,
58
-                                         CFDictionaryRef userInfo) {
54
+void broadcastStartedNotificationCallback(CFNotificationCenterRef center,
55
+                                          void *observer,
56
+                                          CFStringRef name,
57
+                                          const void *object,
58
+                                          CFDictionaryRef userInfo) {
59 59
     ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
60
-    [externalAPI toggleScreenShare];
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];
61 70
 }
62 71
 
63 72
 @end

+ 9
- 6
react/features/base/conference/middleware.native.js Näytä tiedosto

@@ -13,7 +13,7 @@ import './middleware.any';
13 13
 MiddlewareRegistry.register(store => next => action => {
14 14
     switch (action.type) {
15 15
     case TOGGLE_SCREENSHARING: {
16
-        _toggleScreenSharing(store);
16
+        _toggleScreenSharing(action.enabled, store);
17 17
         break;
18 18
     }
19 19
     }
@@ -25,19 +25,22 @@ MiddlewareRegistry.register(store => next => action => {
25 25
  * Toggles screen sharing.
26 26
  *
27 27
  * @private
28
+ * @param {boolean} enabled - The state to toggle screen sharing to.
28 29
  * @param {Store} store - The redux.
29 30
  * @returns {void}
30 31
  */
31
-function _toggleScreenSharing(store) {
32
+function _toggleScreenSharing(enabled, store) {
32 33
     const { dispatch, getState } = store;
33 34
     const state = getState();
34 35
 
35
-    const isSharing = isLocalVideoTrackDesktop(state);
36
+    if (enabled) {
37
+        const isSharing = isLocalVideoTrackDesktop(state);
36 38
 
37
-    if (isSharing) {
38
-        dispatch(destroyLocalDesktopTrackIfExists());
39
+        if (!isSharing) {
40
+            _startScreenSharing(dispatch, state);
41
+        }
39 42
     } else {
40
-        _startScreenSharing(dispatch, state);
43
+        dispatch(destroyLocalDesktopTrackIfExists());
41 44
     }
42 45
 }
43 46
 

+ 4
- 1
react/features/base/tracks/actions.js Näytä tiedosto

@@ -257,15 +257,18 @@ export function showNoDataFromSourceVideoError(jitsiTrack) {
257 257
  * Signals that the local participant is ending screensharing or beginning the
258 258
  * screensharing flow.
259 259
  *
260
+ * @param {boolean} enabled - The state to toggle screen sharing to.
260 261
  * @param {boolean} audioOnly - Only share system audio.
261 262
  * @returns {{
262 263
  *     type: TOGGLE_SCREENSHARING,
264
+ *     on: boolean,
263 265
  *     audioOnly: boolean
264 266
  * }}
265 267
  */
266
-export function toggleScreensharing(audioOnly = false) {
268
+export function toggleScreensharing(enabled, audioOnly = false) {
267 269
     return {
268 270
         type: TOGGLE_SCREENSHARING,
271
+        enabled,
269 272
         audioOnly
270 273
     };
271 274
 }

+ 2
- 2
react/features/mobile/external-api/middleware.js Näytä tiedosto

@@ -300,8 +300,8 @@ function _registerForNativeEvents(store) {
300 300
         }
301 301
     });
302 302
 
303
-    eventEmitter.addListener(ExternalAPI.TOGGLE_SCREEN_SHARE, () => {
304
-        dispatch(toggleScreensharing());
303
+    eventEmitter.addListener(ExternalAPI.TOGGLE_SCREEN_SHARE, ({ enabled }) => {
304
+        dispatch(toggleScreensharing(enabled));
305 305
     });
306 306
 
307 307
     eventEmitter.addListener(ExternalAPI.RETRIEVE_PARTICIPANTS_INFO, ({ requestId }) => {

+ 3
- 1
react/features/toolbox/components/native/ScreenSharingAndroidButton.js Näytä tiedosto

@@ -39,7 +39,9 @@ class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
39 39
      * @returns {void}
40 40
      */
41 41
     _handleClick() {
42
-        this.props.dispatch(toggleScreensharing());
42
+        const enable = !this._isToggled();
43
+
44
+        this.props.dispatch(toggleScreensharing(enable));
43 45
     }
44 46
 
45 47
     /**

+ 14
- 7
react/features/toolbox/components/web/Toolbox.js Näytä tiedosto

@@ -504,12 +504,13 @@ class Toolbox extends Component<Props> {
504 504
      * Dispatches an action to toggle screensharing.
505 505
      *
506 506
      * @private
507
+     * @param {boolean} enabled - The state to toggle screen sharing to.
507 508
      * @param {boolean} audioOnly - Only share system audio.
508 509
      * @returns {void}
509 510
      */
510
-    _doToggleScreenshare(audioOnly = false) {
511
+    _doToggleScreenshare(enabled, audioOnly = false) {
511 512
         if (this.props._desktopSharingEnabled) {
512
-            this.props.dispatch(toggleScreensharing(audioOnly));
513
+            this.props.dispatch(toggleScreensharing(enabled, audioOnly));
513 514
         }
514 515
     }
515 516
 
@@ -690,13 +691,15 @@ class Toolbox extends Component<Props> {
690 691
      * @returns {void}
691 692
      */
692 693
     _onShortcutToggleScreenshare() {
694
+        const enable = !this.props._screensharing;
695
+
693 696
         sendAnalytics(createToolbarEvent(
694 697
             'screen.sharing',
695 698
             {
696
-                enable: !this.props._screensharing
699
+                enable
697 700
             }));
698 701
 
699
-        this._doToggleScreenshare();
702
+        this._doToggleScreenshare(enable);
700 703
     }
701 704
 
702 705
     _onTabIn: () => void;
@@ -889,13 +892,15 @@ class Toolbox extends Component<Props> {
889 892
             return;
890 893
         }
891 894
 
895
+        const enable = !this.props._screensharing;
896
+
892 897
         sendAnalytics(createShortcutEvent(
893 898
             'toggle.screen.sharing',
894 899
             ACTION_SHORTCUT_TRIGGERED,
895
-            { enable: !this.props._screensharing }));
900
+            { enable }));
896 901
 
897 902
         this._closeOverflowMenuIfOpen();
898
-        this._doToggleScreenshare();
903
+        this._doToggleScreenshare(enable);
899 904
     }
900 905
 
901 906
     _onToolbarToggleShareAudio: () => void;
@@ -906,8 +911,10 @@ class Toolbox extends Component<Props> {
906 911
      * @returns {void}
907 912
      */
908 913
     _onToolbarToggleShareAudio() {
914
+        const enable = !this.props._screensharing;
915
+
909 916
         this._closeOverflowMenuIfOpen();
910
-        this._doToggleScreenshare(true);
917
+        this._doToggleScreenshare(enable, true);
911 918
     }
912 919
 
913 920
     _onToolbarOpenLocalRecordingInfoDialog: () => void;

Loading…
Peruuta
Tallenna