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

pull/8966/head jitsi-meet_5824
Alex Bumbu 4 years ago committed by Saúl Ibarra Corretgé
parent f187923233
commit cf37d34923
  1. 6
      android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java
  2. 2
      ios/sdk/sdk.xcodeproj/project.pbxproj
  3. 2
      ios/sdk/src/ExternalAPI.h
  4. 7
      ios/sdk/src/ExternalAPI.m
  5. 2
      ios/sdk/src/JitsiMeetView.h
  6. 4
      ios/sdk/src/JitsiMeetView.m
  7. 25
      ios/sdk/src/ScheenshareEventEmiter.m
  8. 15
      react/features/base/conference/middleware.native.js
  9. 5
      react/features/base/tracks/actions.js
  10. 4
      react/features/mobile/external-api/middleware.js
  11. 4
      react/features/toolbox/components/native/ScreenSharingAndroidButton.js
  12. 21
      react/features/toolbox/components/web/Toolbox.js

@ -20,8 +20,10 @@ public class BroadcastIntentHelper {
return intent;
}
public static Intent buildToggleScreenShareIntent() {
return new Intent(BroadcastAction.Type.TOGGLE_SCREEN_SHARE.getAction());
public static Intent buildToggleScreenShareIntent(boolean enabled) {
Intent intent = new Intent(BroadcastAction.Type.TOGGLE_SCREEN_SHARE.getAction());
intent.putExtra("enabled", enabled);
return intent;
}
public static Intent buildOpenChatIntent(String participantId) {

@ -198,7 +198,6 @@
0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
C69EFA02209A0EFD0027712B /* callkit */,
A4A934E7212F3AB8001E9388 /* dropbox */,
0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
0BD906E91EC0C00300C8C18E /* Info.plist */,
DE438CD82350934700DD541D /* JavaScriptSandbox.m */,
0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
@ -235,6 +234,7 @@
C8AFD27D2462C613000293D2 /* InfoPlistUtil.h */,
C8AFD27E2462C613000293D2 /* InfoPlistUtil.m */,
C81E9AB825AC5AD800B134D9 /* ExternalAPI.h */,
0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */,
4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */,
);

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

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

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

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

@ -42,8 +42,8 @@ NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped"
// MARK: Private Methods
- (void)setupObserver {
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastToggleNotificationCallback, (__bridge CFStringRef)kBroadcastStartedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastToggleNotificationCallback, (__bridge CFStringRef)kBroadcastStoppedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStartedNotificationCallback, (__bridge CFStringRef)kBroadcastStartedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(_notificationCenter, (__bridge const void *)(self), broadcastStoppedNotificationCallback, (__bridge CFStringRef)kBroadcastStoppedNotification, NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
}
- (void)clearObserver {
@ -51,13 +51,22 @@ NSNotificationName const kBroadcastStoppedNotification = @"iOS_BroadcastStopped"
CFNotificationCenterRemoveObserver(_notificationCenter, (__bridge const void *)(self), (__bridge CFStringRef)kBroadcastStoppedNotification, NULL);
}
void broadcastToggleNotificationCallback(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
void broadcastStartedNotificationCallback(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
[externalAPI toggleScreenShare];
[externalAPI toggleScreenShare:true];
}
void broadcastStoppedNotificationCallback(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
[externalAPI toggleScreenShare:false];
}
@end

@ -13,7 +13,7 @@ import './middleware.any';
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case TOGGLE_SCREENSHARING: {
_toggleScreenSharing(store);
_toggleScreenSharing(action.enabled, store);
break;
}
}
@ -25,19 +25,22 @@ MiddlewareRegistry.register(store => next => action => {
* Toggles screen sharing.
*
* @private
* @param {boolean} enabled - The state to toggle screen sharing to.
* @param {Store} store - The redux.
* @returns {void}
*/
function _toggleScreenSharing(store) {
function _toggleScreenSharing(enabled, store) {
const { dispatch, getState } = store;
const state = getState();
const isSharing = isLocalVideoTrackDesktop(state);
if (enabled) {
const isSharing = isLocalVideoTrackDesktop(state);
if (isSharing) {
dispatch(destroyLocalDesktopTrackIfExists());
if (!isSharing) {
_startScreenSharing(dispatch, state);
}
} else {
_startScreenSharing(dispatch, state);
dispatch(destroyLocalDesktopTrackIfExists());
}
}

@ -257,15 +257,18 @@ export function showNoDataFromSourceVideoError(jitsiTrack) {
* Signals that the local participant is ending screensharing or beginning the
* screensharing flow.
*
* @param {boolean} enabled - The state to toggle screen sharing to.
* @param {boolean} audioOnly - Only share system audio.
* @returns {{
* type: TOGGLE_SCREENSHARING,
* on: boolean,
* audioOnly: boolean
* }}
*/
export function toggleScreensharing(audioOnly = false) {
export function toggleScreensharing(enabled, audioOnly = false) {
return {
type: TOGGLE_SCREENSHARING,
enabled,
audioOnly
};
}

@ -300,8 +300,8 @@ function _registerForNativeEvents(store) {
}
});
eventEmitter.addListener(ExternalAPI.TOGGLE_SCREEN_SHARE, () => {
dispatch(toggleScreensharing());
eventEmitter.addListener(ExternalAPI.TOGGLE_SCREEN_SHARE, ({ enabled }) => {
dispatch(toggleScreensharing(enabled));
});
eventEmitter.addListener(ExternalAPI.RETRIEVE_PARTICIPANTS_INFO, ({ requestId }) => {

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

@ -504,12 +504,13 @@ class Toolbox extends Component<Props> {
* Dispatches an action to toggle screensharing.
*
* @private
* @param {boolean} enabled - The state to toggle screen sharing to.
* @param {boolean} audioOnly - Only share system audio.
* @returns {void}
*/
_doToggleScreenshare(audioOnly = false) {
_doToggleScreenshare(enabled, audioOnly = false) {
if (this.props._desktopSharingEnabled) {
this.props.dispatch(toggleScreensharing(audioOnly));
this.props.dispatch(toggleScreensharing(enabled, audioOnly));
}
}
@ -690,13 +691,15 @@ class Toolbox extends Component<Props> {
* @returns {void}
*/
_onShortcutToggleScreenshare() {
const enable = !this.props._screensharing;
sendAnalytics(createToolbarEvent(
'screen.sharing',
{
enable: !this.props._screensharing
enable
}));
this._doToggleScreenshare();
this._doToggleScreenshare(enable);
}
_onTabIn: () => void;
@ -889,13 +892,15 @@ class Toolbox extends Component<Props> {
return;
}
const enable = !this.props._screensharing;
sendAnalytics(createShortcutEvent(
'toggle.screen.sharing',
ACTION_SHORTCUT_TRIGGERED,
{ enable: !this.props._screensharing }));
{ enable }));
this._closeOverflowMenuIfOpen();
this._doToggleScreenshare();
this._doToggleScreenshare(enable);
}
_onToolbarToggleShareAudio: () => void;
@ -906,8 +911,10 @@ class Toolbox extends Component<Props> {
* @returns {void}
*/
_onToolbarToggleShareAudio() {
const enable = !this.props._screensharing;
this._closeOverflowMenuIfOpen();
this._doToggleScreenshare(true);
this._doToggleScreenshare(enable, true);
}
_onToolbarOpenLocalRecordingInfoDialog: () => void;

Loading…
Cancel
Save