Update getTheme for full screen calls

This commit is contained in:
ayumi-signal 2024-06-13 06:59:22 -07:00 committed by GitHub
parent 511a7f1646
commit cd5984e82a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,12 +3,13 @@
import { createSelector } from 'reselect';
import type { LocalizerType, ThemeType } from '../../types/Util';
import { type LocalizerType, ThemeType } from '../../types/Util';
import type { AciString, PniString } from '../../types/ServiceId';
import type { LocaleMessagesType } from '../../types/I18N';
import type { MenuOptionsType } from '../../types/menu';
import type { StateType } from '../reducer';
import type { CallingStateType } from '../ducks/calling';
import type { UserStateType } from '../ducks/user';
import { isAlpha, isBeta } from '../../util/version';
@ -80,11 +81,26 @@ export const getTempPath = createSelector(
(state: UserStateType): string => state.tempPath
);
export const getTheme = createSelector(
export const getPreferredTheme = createSelector(
getUser,
(state: UserStateType): ThemeType => state.theme
);
// Also defined in calling selectors, redefined to avoid circular dependency
const getIsInFullScreenCall = createSelector(
(state: StateType): CallingStateType => state.calling,
(state: CallingStateType): boolean =>
Boolean(state.activeCallState && !state.activeCallState.pip)
);
export const getTheme = createSelector(
getPreferredTheme,
getIsInFullScreenCall,
(theme: ThemeType, isInCall: boolean): ThemeType => {
return isInCall ? ThemeType.dark : theme;
}
);
const getVersion = createSelector(
getUser,
(state: UserStateType) => state.version