Dark theme loading screen

This commit is contained in:
Fedor Indutny 2022-05-11 15:58:14 -07:00 committed by GitHub
parent af2c884c9f
commit b30c7f9c46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 114 additions and 18 deletions

View file

@ -29,6 +29,7 @@ import type { Receipt } from './types/Receipt';
import { getTitleBarVisibility, TitleBarVisibility } from './types/Settings';
import { SocketStatus } from './types/SocketStatus';
import { DEFAULT_CONVERSATION_COLOR } from './types/Colors';
import { ThemeType } from './types/Util';
import { ChallengeHandler } from './challenge';
import * as durations from './util/durations';
import { explodePromise } from './util/explodePromise';
@ -166,6 +167,13 @@ export async function cleanupSessionResets(): Promise<void> {
}
export async function startApp(): Promise<void> {
if (window.initialTheme === ThemeType.light) {
document.body.classList.add('light-theme');
}
if (window.initialTheme === ThemeType.dark) {
document.body.classList.add('dark-theme');
}
const idleDetector = new IdleDetector();
await KeyboardLayout.initialize();

View file

@ -17,6 +17,7 @@ import type {
const EPHEMERAL_NAME_MAP = new Map([
['spellCheck', 'spell-check'],
['systemTraySetting', 'system-tray-setting'],
['themeSetting', 'theme-setting'],
]);
type ResponseQueueEntry = Readonly<{
@ -68,7 +69,9 @@ export class SettingsChannel {
this.installSetting('readReceiptSetting', { setter: false });
this.installSetting('typingIndicatorSetting', { setter: false });
this.installSetting('themeSetting');
this.installSetting('themeSetting', {
isEphemeral: true,
});
this.installSetting('hideMenuBar');
this.installSetting('systemTraySetting', {
isEphemeral: true,

3
ts/window.d.ts vendored
View file

@ -29,7 +29,7 @@ import * as Curve from './Curve';
import * as RemoteConfig from './RemoteConfig';
import * as OS from './OS';
import { getEnvironment } from './environment';
import { LocalizerType } from './types/Util';
import { LocalizerType, ThemeType } from './types/Util';
import type { Receipt } from './types/Receipt';
import { ConversationController } from './ConversationController';
import { ReduxActions } from './state/types';
@ -212,6 +212,7 @@ declare global {
isAfterVersion: (version: string, anotherVersion: string) => boolean;
isBeforeVersion: (version: string, anotherVersion: string) => boolean;
isFullScreen: () => boolean;
initialTheme?: ThemeType;
libphonenumber: {
util: {
getRegionCodeForNumber: (number: string) => string;