2021-10-20 04:35:39 +08:00
|
|
|
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';
|
2021-04-01 19:14:24 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2023-03-21 03:28:57 +08:00
|
|
|
import Styled from './styles';
|
|
|
|
import DarkReader from 'darkreader';
|
|
|
|
import logger from '/imports/startup/client/logger';
|
2016-05-11 03:39:01 +08:00
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export const getFontSize = () => {
|
2017-04-06 19:46:15 +08:00
|
|
|
const applicationSettings = Settings.application;
|
|
|
|
return applicationSettings ? applicationSettings.fontSize : '16px';
|
2016-12-23 08:44:31 +08:00
|
|
|
};
|
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export const getBreakoutRooms = () => Breakouts.find().fetch();
|
2018-10-24 01:18:09 +08:00
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export function meetingIsBreakout() {
|
|
|
|
const meeting = Meetings.findOne(
|
|
|
|
{ meetingId: Auth.meetingID },
|
2024-03-26 19:57:28 +08:00
|
|
|
{ fields: { isBreakout: 1 } },
|
2023-07-25 02:56:40 +08:00
|
|
|
);
|
2024-03-26 19:57:28 +08:00
|
|
|
return meeting && meeting.isBreakout;
|
2017-03-17 22:23:00 +08:00
|
|
|
}
|
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export const setDarkTheme = (value) => {
|
2023-03-21 03:28:57 +08:00
|
|
|
if (value && !DarkReader.isEnabled()) {
|
2023-07-25 02:56:40 +08:00
|
|
|
DarkReader.enable(
|
|
|
|
{ brightness: 100, contrast: 90 },
|
|
|
|
{
|
|
|
|
invert: [Styled.DtfInvert],
|
|
|
|
ignoreInlineStyle: [Styled.DtfCss],
|
|
|
|
ignoreImageAnalysis: [Styled.DtfImages],
|
|
|
|
}
|
|
|
|
);
|
|
|
|
logger.info(
|
|
|
|
{
|
2023-03-21 03:28:57 +08:00
|
|
|
logCode: 'dark_mode',
|
2023-07-25 02:56:40 +08:00
|
|
|
},
|
|
|
|
'Dark mode is on.'
|
|
|
|
);
|
2023-03-21 03:28:57 +08:00
|
|
|
}
|
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
if (!value && DarkReader.isEnabled()) {
|
2023-03-21 03:28:57 +08:00
|
|
|
DarkReader.disable();
|
2023-07-25 02:56:40 +08:00
|
|
|
logger.info(
|
|
|
|
{
|
|
|
|
logCode: 'dark_mode',
|
|
|
|
},
|
|
|
|
'Dark mode is off.'
|
|
|
|
);
|
2023-03-21 03:28:57 +08:00
|
|
|
}
|
2023-07-25 02:56:40 +08:00
|
|
|
};
|
2023-03-21 03:28:57 +08:00
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export const isDarkThemeEnabled = () => {
|
|
|
|
return DarkReader.isEnabled();
|
|
|
|
};
|
2023-03-21 03:28:57 +08:00
|
|
|
|
2023-07-25 02:56:40 +08:00
|
|
|
export default {
|
2017-02-25 04:19:53 +08:00
|
|
|
getFontSize,
|
2017-03-15 04:57:22 +08:00
|
|
|
meetingIsBreakout,
|
2018-10-24 01:18:09 +08:00
|
|
|
getBreakoutRooms,
|
2023-03-21 03:28:57 +08:00
|
|
|
setDarkTheme,
|
|
|
|
isDarkThemeEnabled,
|
2016-05-12 23:41:51 +08:00
|
|
|
};
|