diff options
author | V <vendicated@riseup.net> | 2023-05-02 02:50:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 02:50:51 +0200 |
commit | c62d05e1b32361425474928004a92338d98ba200 (patch) | |
tree | 63e2d718807055dbdbbe7d2624270d8aa138fa2d /src/api/settings.ts | |
parent | 6a1cb133cd6cbe2946e4c830291318e873da1d8b (diff) | |
download | Vencord-c62d05e1b32361425474928004a92338d98ba200.tar.gz Vencord-c62d05e1b32361425474928004a92338d98ba200.tar.bz2 Vencord-c62d05e1b32361425474928004a92338d98ba200.zip |
Refactor ipc to be strongly typed and hide impl details (#1018)
Diffstat (limited to 'src/api/settings.ts')
-rw-r--r-- | src/api/settings.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/api/settings.ts b/src/api/settings.ts index 35381d8..2329f94 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -17,7 +17,6 @@ */ import { debounce } from "@utils/debounce"; -import IpcEvents from "@utils/IpcEvents"; import { localStorage } from "@utils/localStorage"; import Logger from "@utils/Logger"; import { mergeDefaults } from "@utils/misc"; @@ -94,7 +93,7 @@ const DefaultSettings: Settings = { }; try { - var settings = JSON.parse(VencordNative.ipc.sendSync(IpcEvents.GET_SETTINGS)) as Settings; + var settings = JSON.parse(VencordNative.settings.get()) as Settings; mergeDefaults(settings, DefaultSettings); } catch (err) { var settings = mergeDefaults({} as Settings, DefaultSettings); @@ -173,7 +172,7 @@ function makeProxy(settings: any, root = settings, path = ""): Settings { PlainSettings.cloud.settingsSyncVersion = Date.now(); localStorage.Vencord_settingsDirty = true; saveSettingsOnFrequentAction(); - VencordNative.ipc.invoke(IpcEvents.SET_SETTINGS, JSON.stringify(root, null, 4)); + VencordNative.settings.set(JSON.stringify(root, null, 4)); return true; } }); @@ -249,10 +248,7 @@ export function migratePluginSettings(name: string, ...oldNames: string[]) { logger.info(`Migrating settings from old name ${oldName} to ${name}`); plugins[name] = plugins[oldName]; delete plugins[oldName]; - VencordNative.ipc.invoke( - IpcEvents.SET_SETTINGS, - JSON.stringify(settings, null, 4) - ); + VencordNative.settings.set(JSON.stringify(settings, null, 4)); break; } } |