Add migration from 0.7

This commit is contained in:
Marquis Kurt 2019-05-13 09:42:51 -04:00
parent 538842c36b
commit 935e8c113e
1 changed files with 9 additions and 0 deletions

View File

@ -99,6 +99,9 @@ export function createUserDefaults() {
}
let settings = ["darkModeEnabled", "systemDecidesDarkMode", "clearNotificationsOnRead", "displayAllOnNotificationBadge", "defaultVisibility"];
migrateExistingSettings();
settings.forEach((setting: string) => {
if (localStorage.getItem(setting) === null) {
if (typeof defaults[setting] === "boolean") {
@ -125,4 +128,10 @@ export async function getConfig(): Promise<Config | undefined> {
catch (err) {
console.error("Couldn't configure Hyperspace with the config file. Reason: " + err.name);
}
}
export function migrateExistingSettings() {
if (localStorage.getItem('prefers-dark-mode')) {
setUserDefaultBool('darkModeEnabled', localStorage.getItem('prefers-dark-mode') === "true")
}
}