|
|
@@ -17,6 +17,7 @@ defineOptions({
|
|
|
const { locale } = useI18n();
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
+
|
|
|
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
|
? "dark"
|
|
|
: "light";
|
|
|
@@ -37,13 +38,27 @@ watch(
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
const isNative = Capacitor.isNativePlatform();
|
|
|
- if (isNative) await StatusBar.show();
|
|
|
+
|
|
|
const { value: themePref } = await Preferences.get({ key: "theme" });
|
|
|
const theme = themePref || systemTheme;
|
|
|
- if (isNative) await StatusBar.setStyle({ style: Style.Dark });
|
|
|
+
|
|
|
+ if (isNative) {
|
|
|
+ await StatusBar.show();
|
|
|
+
|
|
|
+ await StatusBar.setBackgroundColor({
|
|
|
+ color: "#FFFFFF",
|
|
|
+ });
|
|
|
+
|
|
|
+ await StatusBar.setStyle({
|
|
|
+ style: Style.Dark,
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
const { value: localePref } = await Preferences.get({ key: "locale" });
|
|
|
const userLocale = localePref || window.navigator.language;
|
|
|
+
|
|
|
console.log(theme, userLocale);
|
|
|
- $q.dark.set(theme == "dark");
|
|
|
+
|
|
|
+ $q.dark.set(theme === "dark");
|
|
|
});
|
|
|
</script>
|