Enable sync on empty localstorage

This commit is contained in:
creesch 2018-03-30 09:46:59 +02:00
parent e967859d5f
commit 107749e91a

View File

@ -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];
}
} }
} }