mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
fix: pr review - added theme and primaryColor to window type
This commit is contained in:
parent
8edd2652b2
commit
03d8f39677
4 changed files with 17 additions and 15 deletions
|
@ -35,12 +35,12 @@ export const AboutView = () => {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
if ((window as any).theme) {
|
||||
if (window.theme) {
|
||||
void switchThemeTo({
|
||||
theme: (window as any).theme,
|
||||
theme: window.theme,
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
}, [window.theme]);
|
||||
|
||||
return (
|
||||
<SessionTheme>
|
||||
|
|
|
@ -77,9 +77,7 @@ const DebugLogViewAndSave = () => {
|
|||
useEffect(() => {
|
||||
const operatingSystemInfo = `Operating System: ${(window as any).getOSRelease()}`;
|
||||
|
||||
const commitHashInfo = (window as any).getCommitHash()
|
||||
? `Commit Hash: ${(window as any).getCommitHash()}`
|
||||
: '';
|
||||
const commitHashInfo = window.getCommitHash() ? `Commit Hash: ${window.getCommitHash()}` : '';
|
||||
|
||||
// eslint-disable-next-line more/no-then
|
||||
fetch()
|
||||
|
@ -100,12 +98,12 @@ const DebugLogViewAndSave = () => {
|
|||
|
||||
export const DebugLogView = () => {
|
||||
useEffect(() => {
|
||||
if ((window as any).theme) {
|
||||
if (window.theme) {
|
||||
void switchThemeTo({
|
||||
theme: (window as any).theme,
|
||||
theme: window.theme,
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
}, [window.theme]);
|
||||
|
||||
return (
|
||||
<SessionTheme>
|
||||
|
@ -116,7 +114,7 @@ export const DebugLogView = () => {
|
|||
iconType="exit"
|
||||
iconSize="medium"
|
||||
onClick={() => {
|
||||
(window as any).closeDebugLog();
|
||||
window.closeDebugLog();
|
||||
}}
|
||||
/>
|
||||
<h1> {window.i18n('debugLog')} </h1>
|
||||
|
|
|
@ -195,15 +195,15 @@ class SessionPasswordPromptInner extends React.PureComponent<{}, State> {
|
|||
|
||||
export const SessionPasswordPrompt = () => {
|
||||
useEffect(() => {
|
||||
if ((window as any).theme) {
|
||||
if (window.theme) {
|
||||
void switchThemeTo({
|
||||
theme: (window as any).theme,
|
||||
theme: window.theme,
|
||||
});
|
||||
}
|
||||
if ((window as any).primaryColor) {
|
||||
void switchPrimaryColorTo((window as any).primaryColor);
|
||||
if (window.primaryColor) {
|
||||
void switchPrimaryColorTo(window.primaryColor);
|
||||
}
|
||||
}, []);
|
||||
}, [window.theme, window.primaryColor]);
|
||||
|
||||
return (
|
||||
<SessionTheme>
|
||||
|
|
4
ts/window.d.ts
vendored
4
ts/window.d.ts
vendored
|
@ -7,6 +7,7 @@ import { Store } from '@reduxjs/toolkit';
|
|||
import { ConversationCollection, ConversationModel } from './models/conversation';
|
||||
import { ConversationType } from './state/ducks/conversations';
|
||||
import { StateType } from './state/reducer';
|
||||
import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors';
|
||||
|
||||
export interface LibTextsecure {
|
||||
messaging: boolean;
|
||||
|
@ -54,6 +55,8 @@ declare global {
|
|||
getCallMediaPermissions: () => boolean;
|
||||
toggleMenuBar: () => void;
|
||||
toggleSpellCheck: any;
|
||||
primaryColor: PrimaryColorStateType;
|
||||
theme: ThemeStateType;
|
||||
setTheme: (newTheme: string) => Promise<void>;
|
||||
isDev?: () => boolean;
|
||||
userConfig: any;
|
||||
|
@ -96,6 +99,7 @@ declare global {
|
|||
getOpengroupPruning: () => Promise<boolean>;
|
||||
setOpengroupPruning: (val: boolean) => Promise<void>;
|
||||
closeAbout: () => void;
|
||||
closeDebugLog: () => void;
|
||||
getAutoUpdateEnabled: () => boolean;
|
||||
setAutoUpdateEnabled: (enabled: boolean) => void;
|
||||
setZoomFactor: (newZoom: number) => void;
|
||||
|
|
Loading…
Reference in a new issue