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 = [];
// 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[key] !== undefined) {
settings[key] = userSettings[key];
if (!userSettings) {
// Enable sync by default if there are no user defined settings.
settings.syncSettings = true;
} else {
for (const key in settings) {
if (userSettings[key] !== undefined) {
settings[key] = userSettings[key];
}
}
}