From 4396c012c6ddd3808c0ce23554c111db8492774d Mon Sep 17 00:00:00 2001 From: KaiserBh Date: Fri, 29 Dec 2023 01:55:39 +1100 Subject: [PATCH] feat: Add on create so it just does it once when app launches. Signed-off-by: KaiserBh --- app/src/main/java/eu/kanade/tachiyomi/App.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 8434071df..9a4e6e1f6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -137,6 +137,13 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { if (!LogcatLogger.isInstalled && networkPreferences.verboseLogging().get()) { LogcatLogger.install(AndroidLogcatLogger(LogPriority.VERBOSE)) } + + + val syncPreferences: SyncPreferences by injectLazy() + val syncFlags = syncPreferences.syncFlags().get() + if (syncPreferences.isSyncEnabled() && syncFlags and SyncPreferences.Flags.SYNC_ON_APP_START == SyncPreferences.Flags.SYNC_ON_APP_START) { + SyncDataJob.startNow(this@App) + } } override fun newImageLoader(): ImageLoader { @@ -173,7 +180,7 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory { val syncPreferences: SyncPreferences by injectLazy() val syncFlags = syncPreferences.syncFlags().get() - if (syncPreferences.syncService().get() != 0 && syncFlags and SyncPreferences.Flags.SYNC_ON_APP_START == SyncPreferences.Flags.SYNC_ON_APP_START) { + if (syncPreferences.isSyncEnabled() && syncFlags and SyncPreferences.Flags.SYNC_ON_APP_RESUME == SyncPreferences.Flags.SYNC_ON_APP_RESUME) { SyncDataJob.startNow(this@App) } }