2017-06-11 10:21:37 +08:00
|
|
|
import Storage from '/imports/ui/services/storage/session';
|
2017-07-15 07:20:16 +08:00
|
|
|
import Users from '/imports/api/2.0/users';
|
2017-06-17 10:32:41 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-06-11 10:21:37 +08:00
|
|
|
|
|
|
|
const setTextShapeValue = (text) => {
|
2017-07-15 07:20:16 +08:00
|
|
|
const drawSettings = Storage.getItem('drawSettings');
|
|
|
|
if (drawSettings) {
|
2017-06-17 10:32:41 +08:00
|
|
|
drawSettings.textShape.textShapeValue = text;
|
|
|
|
Storage.setItem('drawSettings', JSON.stringify(drawSettings));
|
|
|
|
}
|
2017-06-11 10:21:37 +08:00
|
|
|
};
|
|
|
|
|
2017-06-17 10:32:41 +08:00
|
|
|
const isPresenter = () => {
|
2017-07-15 07:20:16 +08:00
|
|
|
const currentUser = Users.findOne({ userId: Auth.userID });
|
2017-06-17 10:32:41 +08:00
|
|
|
|
|
|
|
if (currentUser && currentUser.user) {
|
|
|
|
return currentUser.user.presenter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
const activeTextShapeId = () => {
|
2017-07-15 07:20:16 +08:00
|
|
|
const drawSettings = Storage.getItem('drawSettings');
|
2017-06-17 10:32:41 +08:00
|
|
|
|
2017-07-15 07:20:16 +08:00
|
|
|
if (drawSettings) {
|
2017-06-17 10:32:41 +08:00
|
|
|
return drawSettings.textShape.textShapeActiveId;
|
|
|
|
}
|
2017-08-20 14:32:01 +08:00
|
|
|
|
|
|
|
return undefined;
|
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-06-11 10:21:37 +08:00
|
|
|
};
|