mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
feat: add auto syncing to premium features
This commit is contained in:
@@ -11,7 +11,7 @@ import Backup from "../database/backup";
|
||||
import Conflicts from "./sync/conflicts";
|
||||
import Session from "./session";
|
||||
import Constants from "../utils/constants";
|
||||
import { EV, EVENTS } from "../common";
|
||||
import { CHECK_IDS, EV, EVENTS, sendCheckUserStatusEvent } from "../common";
|
||||
import Settings from "./settings";
|
||||
import Migrations from "./migrations";
|
||||
import Outbox from "./outbox";
|
||||
@@ -141,7 +141,8 @@ class Database {
|
||||
EV.publish(EVENTS.userEmailConfirmed);
|
||||
break;
|
||||
case "sync":
|
||||
await this.syncer.eventMerge(data);
|
||||
if (await sendCheckUserStatusEvent(CHECK_IDS.databaseSync))
|
||||
await this.syncer.eventMerge(data);
|
||||
break;
|
||||
}
|
||||
};
|
||||
@@ -151,8 +152,11 @@ class Database {
|
||||
return this.context.read("lastSynced");
|
||||
}
|
||||
|
||||
_onDBWrite(item) {
|
||||
if (item.remote) {
|
||||
async _onDBWrite(item) {
|
||||
if (
|
||||
item.remote ||
|
||||
!(await sendCheckUserStatusEvent(CHECK_IDS.databaseSync))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this._syncTimeout);
|
||||
|
||||
Reference in New Issue
Block a user