From cce40ab1d2ad8cc1b60fabb4cc8281ea0490a123 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 26 Dec 2021 01:59:17 +0100 Subject: feat: Set nativeTheme theme source on dark mode --- packages/shared/src/stores/Config.ts | 42 +++++++++++++++++++++++++++++++ packages/shared/src/stores/SharedStore.ts | 4 +++ 2 files changed, 46 insertions(+) create mode 100644 packages/shared/src/stores/Config.ts (limited to 'packages/shared/src/stores') diff --git a/packages/shared/src/stores/Config.ts b/packages/shared/src/stores/Config.ts new file mode 100644 index 0000000..1a9f924 --- /dev/null +++ b/packages/shared/src/stores/Config.ts @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021-2022 Kristóf Marussy + * + * This file is part of Sophie. + * + * Sophie is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { + Instance, + types, + SnapshotIn, + SnapshotOut, +} from 'mobx-state-tree'; + +import { themeSource } from '../schemas'; + +export const config = types.model("Config", { + themeSource: types.enumeration(themeSource.options), +}); + +export const defaultConfig: ConfigSnapshotIn = { + themeSource: 'system', +}; + +export interface Config extends Instance {} + +export interface ConfigSnapshotIn extends SnapshotIn {} + +export interface ConfigSnapshotOut extends SnapshotOut {} diff --git a/packages/shared/src/stores/SharedStore.ts b/packages/shared/src/stores/SharedStore.ts index 9c7d5ad..9f0afb1 100644 --- a/packages/shared/src/stores/SharedStore.ts +++ b/packages/shared/src/stores/SharedStore.ts @@ -26,11 +26,15 @@ import { SnapshotOut, } from 'mobx-state-tree'; +import { config, defaultConfig } from './Config'; + export const sharedStore = types.model("SharedStore", { + config, shouldUseDarkColors: true, }); export const emptySharedStore: SharedStoreSnapshotIn = { + config: defaultConfig, }; export interface SharedStore extends Instance {} -- cgit v1.2.3-70-g09d2