2017-06-28 06:14:53 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Users from '/imports/api/users';
|
2017-09-25 23:39:56 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2017-10-12 10:00:28 +08:00
|
|
|
import VoiceUsers from '/imports/api/voice-users';
|
2016-12-21 02:06:01 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const isUserPresenter = () => Users.findOne({
|
2017-04-29 00:15:29 +08:00
|
|
|
userId: Auth.userID,
|
2017-07-26 22:09:07 +08:00
|
|
|
}).presenter;
|
2017-03-17 07:30:46 +08:00
|
|
|
|
2017-09-25 23:39:56 +08:00
|
|
|
const toggleSelfVoice = () => makeCall('toggleSelfVoice');
|
|
|
|
|
|
|
|
const getVoiceUserData = () => {
|
|
|
|
const userId = Auth.userID;
|
|
|
|
const voiceUser = VoiceUsers.findOne({ intId: userId });
|
|
|
|
|
|
|
|
const { muted, joined, talking, listenOnly } = voiceUser;
|
|
|
|
|
|
|
|
return ({
|
|
|
|
isInAudio: joined,
|
|
|
|
isMuted: muted,
|
|
|
|
isTalking: talking,
|
|
|
|
listenOnly,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2016-12-21 02:06:01 +08:00
|
|
|
export default {
|
|
|
|
isUserPresenter,
|
2017-09-25 23:39:56 +08:00
|
|
|
toggleSelfVoice,
|
|
|
|
getVoiceUserData,
|
2016-12-21 02:06:01 +08:00
|
|
|
};
|