2017-06-11 10:21:37 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
2021-09-07 04:51:42 +08:00
|
|
|
import Users from '/imports/ui/local-collections/users-collection/users';
|
2017-06-17 10:32:41 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-06-11 10:21:37 +08:00
|
|
|
|
2017-09-21 05:05:17 +08:00
|
|
|
const DRAW_SETTINGS = 'drawSettings';
|
|
|
|
|
2017-06-11 10:21:37 +08:00
|
|
|
const setTextShapeValue = (text) => {
|
2017-09-21 05:05:17 +08:00
|
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
2017-07-15 07:20:16 +08:00
|
|
|
if (drawSettings) {
|
2017-06-17 10:32:41 +08:00
|
|
|
drawSettings.textShape.textShapeValue = text;
|
2017-09-21 05:05:17 +08:00
|
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
2017-06-17 10:32:41 +08:00
|
|
|
}
|
2017-06-11 10:21:37 +08:00
|
|
|
};
|
|
|
|
|
2017-08-24 11:35:34 +08:00
|
|
|
const resetTextShapeActiveId = () => {
|
2017-09-21 05:05:17 +08:00
|
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
2017-08-24 11:35:34 +08:00
|
|
|
if (drawSettings) {
|
|
|
|
drawSettings.textShape.textShapeActiveId = '';
|
2017-09-21 05:05:17 +08:00
|
|
|
Storage.setItem(DRAW_SETTINGS, drawSettings);
|
2017-08-24 11:35:34 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-06-17 10:32:41 +08:00
|
|
|
const isPresenter = () => {
|
2019-08-30 00:26:07 +08:00
|
|
|
const currentUser = Users.findOne({ userId: Auth.userID }, { fields: { presenter: 1 } });
|
2017-09-21 05:05:17 +08:00
|
|
|
return currentUser ? currentUser.presenter : false;
|
2017-06-17 10:32:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const activeTextShapeId = () => {
|
2017-09-21 05:05:17 +08:00
|
|
|
const drawSettings = Storage.getItem(DRAW_SETTINGS);
|
|
|
|
return drawSettings ? drawSettings.textShape.textShapeActiveId : '';
|
2017-07-15 07:20:16 +08:00
|
|
|
};
|
2017-06-17 10:32:41 +08:00
|
|
|
|
2017-06-11 10:21:37 +08:00
|
|
|
export default {
|
|
|
|
setTextShapeValue,
|
2017-06-17 10:32:41 +08:00
|
|
|
activeTextShapeId,
|
|
|
|
isPresenter,
|
2017-08-24 11:35:34 +08:00
|
|
|
resetTextShapeActiveId,
|
2017-06-11 10:21:37 +08:00
|
|
|
};
|