Enable sync on empty localstorage
This commit is contained in:
parent
e967859d5f
commit
107749e91a
@ -49,11 +49,16 @@ const noSync = ["syncSettings"];
|
|||||||
const alwaysSync = [];
|
const alwaysSync = [];
|
||||||
|
|
||||||
// Process usersettings from localstorage.
|
// Process usersettings from localstorage.
|
||||||
let userSettings = JSON.parse(storage.get("settings")) || {};
|
let userSettings = JSON.parse(storage.get("settings")) || false;
|
||||||
|
|
||||||
for (const key in settings) {
|
if (!userSettings) {
|
||||||
if (userSettings[key] !== undefined) {
|
// Enable sync by default if there are no user defined settings.
|
||||||
settings[key] = userSettings[key];
|
settings.syncSettings = true;
|
||||||
|
} else {
|
||||||
|
for (const key in settings) {
|
||||||
|
if (userSettings[key] !== undefined) {
|
||||||
|
settings[key] = userSettings[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user