mirror of https://github.com/jitsi/jitsi-meet
feat: add toggleWhiteboard to Jitsi API (#13292)
* add toggleWhiteboard to Jitsi API * eslint recommendations applied * Prevent to send whiteboard status change notifications for mobile * Fix code style errors (eslint) * Requested changes (by mihhu) have been made. --------- Co-authored-by: Fikret Huseynkhanov <fikret.huseynkhanov@simbrella.com>pull/13321/head jitsi-meet_8633
parent
ed89f9af20
commit
aaeb1a90e5
@ -0,0 +1,31 @@ |
||||
import { IStore } from '../app/types'; |
||||
|
||||
import { setWhiteboardOpen } from './actions'; |
||||
import { isWhiteboardAllowed, isWhiteboardOpen, isWhiteboardVisible } from './functions'; |
||||
import { WhiteboardStatus } from './types'; |
||||
|
||||
|
||||
/** |
||||
* API to toggle the whiteboard. |
||||
* |
||||
* @returns {Function} |
||||
*/ |
||||
export function toggleWhiteboard() { |
||||
return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { |
||||
const state = getState(); |
||||
const isAllowed = isWhiteboardAllowed(state); |
||||
const isOpen = isWhiteboardOpen(state); |
||||
|
||||
if (isAllowed) { |
||||
if (isOpen && !isWhiteboardVisible(state)) { |
||||
dispatch(setWhiteboardOpen(true)); |
||||
} else if (isOpen && isWhiteboardVisible(state)) { |
||||
dispatch(setWhiteboardOpen(false)); |
||||
} else if (!isOpen) { |
||||
dispatch(setWhiteboardOpen(true)); |
||||
} |
||||
} else if (typeof APP !== 'undefined') { |
||||
APP.API.notifyWhiteboardStatusChanged(WhiteboardStatus.FORBIDDEN); |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,13 @@ |
||||
|
||||
/** |
||||
* Whiteboard statuses used to raise the notification when it's changed. |
||||
* |
||||
* @enum |
||||
*/ |
||||
export enum WhiteboardStatus { |
||||
FORBIDDEN = 'FORBIDDEN', |
||||
HIDDEN = 'HIDDEN', |
||||
INSTANTIATED = 'INSTANTIATED', |
||||
RESET = 'RESET', |
||||
SHOWN = 'SHOWN' |
||||
} |
Loading…
Reference in new issue