Skip to content

Commit e9132a8

Browse files
format
1 parent 632afa3 commit e9132a8

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/lib/systemConfiguration.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ export function getSystemConfiguration() {
5353
});
5454
}
5555

56-
5756
export function isDeviceDarkTheme() {
5857
return new Promise((resolve, reject) => {
59-
if(window.cordova && typeof cordova.exec !== 'function'){
60-
resolve(true)
61-
return
58+
if (window.cordova && typeof cordova.exec !== "function") {
59+
resolve(true);
60+
return;
6261
}
6362
cordova.exec(
6463
(result) => {
@@ -68,9 +67,9 @@ export function isDeviceDarkTheme() {
6867
console.warn(error);
6968
resolve(true);
7069
},
71-
'System',
72-
'getTheme',
73-
[]
70+
"System",
71+
"getTheme",
72+
[],
7473
);
7574
});
76-
}
75+
}

src/palettes/changeTheme/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import "./style.scss";
22
import palette from "components/palette";
33
import appSettings from "lib/settings";
4+
import { isDeviceDarkTheme } from "lib/systemConfiguration";
45
import themes from "theme/list";
56
import { updateSystemTheme } from "theme/preInstalled";
6-
import { isDeviceDarkTheme } from "lib/systemConfiguration";
77

88
export default function changeTheme(type = "editor") {
99
palette(
@@ -58,18 +58,14 @@ function generateHints(type) {
5858
});
5959
}
6060

61-
62-
63-
64-
6561
let previousDark = await isDeviceDarkTheme();
6662
const updateTimeMs = 3000;
6763

6864
let intervalId = setInterval(async () => {
6965
if (appSettings.value.appTheme.toLowerCase() === "system") {
7066
const isDark = await isDeviceDarkTheme();
7167
if (isDark !== previousDark) {
72-
previousDark = isDark
68+
previousDark = isDark;
7369
updateSystemTheme(isDark);
7470
}
7571
}
@@ -87,7 +83,7 @@ function onselect(value) {
8783
if (appSettings.value.appTheme.toLowerCase() === "system") {
8884
const isDark = await isDeviceDarkTheme();
8985
if (isDark !== previousDark) {
90-
previousDark = isDark
86+
previousDark = isDark;
9187
updateSystemTheme(isDark);
9288
}
9389
}

src/theme/preInstalled.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import appSettings from "lib/settings";
2+
import { isDeviceDarkTheme } from "lib/systemConfiguration";
23
import { createBuiltInTheme } from "./builder";
34
import { apply } from "./list";
4-
import { isDeviceDarkTheme } from "lib/systemConfiguration";
55

66
const WHITE = "rgb(255, 255, 255)";
77
const BLACK = "rgb(0, 0, 0)";

0 commit comments

Comments
 (0)