From 3d4c09510b875ac995661c3371fd110314a578b2 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 17 Apr 2022 06:31:35 +0900 Subject: [PATCH] add wallpaper --- .../src/pages/settings/preferences-registry.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/client/src/pages/settings/preferences-registry.vue b/packages/client/src/pages/settings/preferences-registry.vue index 26ddd1fd1..8b5b1c00a 100644 --- a/packages/client/src/pages/settings/preferences-registry.vue +++ b/packages/client/src/pages/settings/preferences-registry.vue @@ -54,6 +54,7 @@ type Registry = { coldDeviceStorage: Partial; fontSize: string | null; useSystemFont: 't' | null; + wallpaper: string | null; }; type Registries = { @@ -99,6 +100,7 @@ async function saveNew() { coldDeviceStorage: ColdDeviceStorage.getAll(), fontSize: localStorage.getItem('fontSize'), useSystemFont: localStorage.getItem('useSystemFont') as 't' | null, + wallpaper: localStorage.getItem('wallpaper'), }; await os.api('i/registry/set', { scope, key: id, value: registry }); registries[id] = registry; @@ -142,6 +144,13 @@ async function applyRegistry(id: string) { localStorage.removeItem('useSystemFont'); } + // wallpaper + if (registry.wallpaper != null) { + localStorage.setItem('wallpaper', registry.wallpaper); + } else { + localStorage.removeItem('wallpaper'); + } + const { canceled: cancel2 } = await os.confirm({ type: 'info', text: ts.reloadToApplySetting, @@ -183,6 +192,9 @@ async function save(id: string) { updatedAt: (new Date()).toISOString(), defaultStore: getDefaultStoreValues(), coldDeviceStorage: ColdDeviceStorage.getAll(), + fontSize: localStorage.getItem('fontSize'), + useSystemFont: localStorage.getItem('useSystemFont') as 't' | null, + wallpaper: localStorage.getItem('wallpaper'), }; await os.api('i/registry/set', { scope, key: id, value: registry }); registries[id] = registry;