Skip to content

Commit

Permalink
fix user setting migration issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed May 15, 2024
1 parent c2738b8 commit 7c845be
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class UserSettings {

for (const key in data) {
if (
key in
[
"autofill",
"driveEncrypted",
Expand All @@ -79,19 +78,35 @@ export class UserSettings {
"oneDriveBusiness",
"oneDriveEncrypted",
"oneDriveRevoked",
"highContrast",
"smartFilter",
"enableContextMenu",
]
].includes(key)
) {
data[key] = data[key] === "true";
} else if (key in ["autolock", "lastRemindingBackupTime", "offset", "zoom"]) {
data[key] = Number(data[key]);
} else if (key in ["advisorIgnoreList"]) {
data[key] = JSON.parse(data[key]);
settings[
key as
| "autofill"
| "driveEncrypted"
| "driveRevoked"
| "dropboxEncrypted"
| "dropboxRevoked"
| "enableContextMenu"
| "oneDriveBusiness"
| "oneDriveEncrypted"
| "oneDriveRevoked"
| "smartFilter"
| "enableContextMenu"
] = data[key] === "true";
} else if (
["autolock", "lastRemindingBackupTime", "offset", "zoom"].includes(key)
) {
settings[
key as "autolock" | "lastRemindingBackupTime" | "offset" | "zoom"
] = Number(data[key]);
} else if (["advisorIgnoreList"].includes(key)) {
settings[key as "advisorIgnoreList"] = JSON.parse(data[key]);
} else {
settings[key as keyof UserSettingsData] = data[key];
}

settings[key as keyof UserSettingsData] = data[key];
}

settings.storageLocation = location;
Expand Down

0 comments on commit 7c845be

Please sign in to comment.