feat: Add on create so it just does it once when app launches.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-12-29 01:55:39 +11:00
parent f1f07c187d
commit 4396c012c6
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

@ -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)
}
}