mobile: cleanup

This commit is contained in:
Ammar Ahmed
2024-02-10 21:30:29 +05:00
committed by Abdullah Atta
parent e84afd37a8
commit b0e304bcea
2 changed files with 2 additions and 8 deletions

View File

@@ -111,10 +111,7 @@ async function onBackgroundSyncStarted() {
try {
if (!db.isInitialized) {
await db.init();
} else {
await db.initCollections();
}
const user = await db.user?.getUser();
if (user) {
await db.sync(true, false);
@@ -130,14 +127,13 @@ async function onBackgroundSyncStarted() {
const onBoot = async () => {
try {
if (!SettingsService.getProperty("backgroundSync")) {
DatabaseLogger.info("BACKGROUND SYNC ON BOOT DISABLED");
return;
}
DatabaseLogger.info("BOOT TASK STARTED");
if (!db.isInitialized) {
await db.init();
} else {
await db.initCollections();
}
await Notifications.setupReminders();
@@ -147,6 +143,7 @@ const onBoot = async () => {
}
DatabaseLogger.info("BOOT TASK COMPLETE");
} catch (e) {
DatabaseLogger.error(e as Error);
console.log(e);
}
};

View File

@@ -25,10 +25,7 @@ import { MMKV } from "../app/common/database/mmkv";
export async function initDatabase() {
if (!db.isInitialized) {
await db.init();
} else {
await db.initCollections();
}
await db.notes.init();
}
const StorageKeys = {