bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotations/text/service.js
2017-09-20 14:05:17 -07:00

46 lines
1.3 KiB
JavaScript

import Storage from '/imports/ui/services/storage/session';
import Users from '/imports/api/2.0/users';
import Auth from '/imports/ui/services/auth';
import WhiteboardMultiUser from '/imports/api/2.0/whiteboard-multi-user/';
const DRAW_SETTINGS = 'drawSettings';
const setTextShapeValue = (text) => {
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeValue = text;
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const resetTextShapeActiveId = () => {
const drawSettings = Storage.getItem(DRAW_SETTINGS);
if (drawSettings) {
drawSettings.textShape.textShapeActiveId = '';
Storage.setItem(DRAW_SETTINGS, drawSettings);
}
};
const isPresenter = () => {
const currentUser = Users.findOne({ userId: Auth.userID });
return currentUser ? currentUser.presenter : false;
};
const getMultiUserStatus = () => {
const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID });
return data ? data.multiUser : false;
};
const activeTextShapeId = () => {
const drawSettings = Storage.getItem(DRAW_SETTINGS);
return drawSettings ? drawSettings.textShape.textShapeActiveId : '';
};
export default {
setTextShapeValue,
activeTextShapeId,
isPresenter,
resetTextShapeActiveId,
getMultiUserStatus,
};