bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/app/service.js

63 lines
1.6 KiB
JavaScript
Raw Normal View History

import Breakouts from '/imports/api/breakouts';
import Meetings from '/imports/api/meetings';
2017-03-29 02:41:48 +08:00
import Settings from '/imports/ui/services/settings';
2017-08-12 01:14:50 +08:00
import Auth from '/imports/ui/services/auth/index';
import deviceInfo from '/imports/utils/deviceInfo';
import Styled from './styles';
import DarkReader from 'darkreader';
import logger from '/imports/startup/client/logger';
const getFontSize = () => {
2017-04-06 19:46:15 +08:00
const applicationSettings = Settings.application;
return applicationSettings ? applicationSettings.fontSize : '16px';
};
2018-10-24 01:18:09 +08:00
const getBreakoutRooms = () => Breakouts.find().fetch();
function meetingIsBreakout() {
const meeting = Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { 'meetingProp.isBreakout': 1 } });
2019-04-06 02:10:05 +08:00
return (meeting && meeting.meetingProp.isBreakout);
}
const validIOSVersion = () => {
const { isIos, isIosVersionSupported } = deviceInfo;
if (isIos) {
return isIosVersionSupported();
}
return true;
};
const setDarkTheme = (value) => {
if (value && !DarkReader.isEnabled()) {
DarkReader.enable(
{ brightness: 100, contrast: 90 },
{ invert: [Styled.DtfInvert], ignoreInlineStyle: [Styled.DtfCss], ignoreImageAnalysis: [Styled.DtfImages] },
)
logger.info({
logCode: 'dark_mode',
}, 'Dark mode is on.');
}
if (!value && DarkReader.isEnabled()){
DarkReader.disable();
logger.info({
logCode: 'dark_mode',
}, 'Dark mode is off.');
}
}
const isDarkThemeEnabled = () => {
return DarkReader.isEnabled()
}
2016-05-13 03:50:02 +08:00
export {
getFontSize,
meetingIsBreakout,
2018-10-24 01:18:09 +08:00
getBreakoutRooms,
validIOSVersion,
setDarkTheme,
isDarkThemeEnabled,
2016-05-12 23:41:51 +08:00
};