fix: settings not getting synced after a change

This commit is contained in:
thecodrr
2021-10-29 13:02:33 +05:00
parent 0bf1a89d1f
commit bac15941b0
4 changed files with 7 additions and 4 deletions

View File

@@ -138,6 +138,7 @@ class Settings {
}
async _saveSettings() {
this._settings.dateEdited = Date.now();
await this._db.storage.write("settings", this._settings);
}
}

View File

@@ -15,7 +15,6 @@ class Collector {
async collect(lastSyncedTimestamp) {
this._lastSyncedTimestamp = lastSyncedTimestamp;
this.key = await this._db.user.getEncryptionKey();
return {
notes: await this._encrypt(this._collect(this._db.notes.raw)),
notebooks: await this._encrypt(this._collect(this._db.notebooks.raw)),

View File

@@ -157,7 +157,7 @@ export default class Sync {
this.stopAutoSync();
this._autoSyncTimeout = setTimeout(() => {
EV.publish(EVENTS.databaseSyncRequested);
}, this._autoSyncTimeout);
}, this._autoSyncInterval);
}
async _send(data) {

View File

@@ -1,6 +1,9 @@
function areAllEmpty(obj) {
const arrays = Object.values(obj).filter((v) => v && v.length !== undefined);
return arrays.every((array) => array.length === 0);
for (let key in obj) {
const value = obj[key];
if (Array.isArray(value) && value.length > 0) return false;
}
return true;
}
export { areAllEmpty };