Use SignalContext instead of SignalWindow
This commit is contained in:
parent
a70a8a88d6
commit
75dab30367
35 changed files with 180 additions and 231 deletions
|
@ -2,13 +2,13 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
async function applyTheme() {
|
||||
const theme = await window.SignalWindow.Settings.themeSetting.getValue();
|
||||
const theme = await window.SignalContext.Settings.themeSetting.getValue();
|
||||
document.body.classList.remove('light-theme');
|
||||
document.body.classList.remove('dark-theme');
|
||||
document.body.classList.add(
|
||||
`${
|
||||
theme === 'system'
|
||||
? window.SignalWindow.context.nativeThemeListener.getSystemTheme()
|
||||
? window.SignalContext.nativeThemeListener.getSystemTheme()
|
||||
: theme
|
||||
}-theme`
|
||||
);
|
||||
|
@ -18,7 +18,7 @@ async function applyThemeLoop() {
|
|||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await window.SignalWindow.Settings.waitForChange();
|
||||
await window.SignalContext.Settings.waitForChange();
|
||||
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await applyTheme();
|
||||
|
@ -28,6 +28,6 @@ async function applyThemeLoop() {
|
|||
applyTheme();
|
||||
applyThemeLoop();
|
||||
|
||||
window.SignalWindow.context.nativeThemeListener.subscribe(() => {
|
||||
window.SignalContext.nativeThemeListener.subscribe(() => {
|
||||
applyTheme();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue