Заголовок задачи синхронизации
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.github.nullptroma.wallenc.app.di.modules.domain
|
||||
|
||||
import com.github.nullptroma.wallenc.app.sync.StorageSyncTaskTitleFormatter
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IStorageSyncEngine
|
||||
import com.github.nullptroma.wallenc.domain.tasks.IStorageSyncTaskTitleFormatter
|
||||
import com.github.nullptroma.wallenc.usecases.StorageSyncEngine
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
@@ -15,4 +17,10 @@ abstract class UseCasesModule {
|
||||
@Binds
|
||||
@Singleton
|
||||
abstract fun bindStorageSyncEngine(impl: StorageSyncEngine): IStorageSyncEngine
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
abstract fun bindStorageSyncTaskTitleFormatter(
|
||||
impl: StorageSyncTaskTitleFormatter,
|
||||
): IStorageSyncTaskTitleFormatter
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.github.nullptroma.wallenc.app.sync
|
||||
|
||||
import com.github.nullptroma.wallenc.domain.datatypes.StorageSyncPaths
|
||||
import com.github.nullptroma.wallenc.domain.interfaces.IVaultsManager
|
||||
import com.github.nullptroma.wallenc.ui.R
|
||||
import com.github.nullptroma.wallenc.ui.resources.UiStringResolver
|
||||
import com.github.nullptroma.wallenc.domain.tasks.StorageSyncTriggerReason
|
||||
import com.github.nullptroma.wallenc.usecases.RunStorageSyncUseCase
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -25,7 +23,6 @@ class StorageSyncBootstrap @Inject constructor(
|
||||
private val scheduler: StorageSyncScheduler,
|
||||
private val vaultsManager: IVaultsManager,
|
||||
private val syncRunner: RunStorageSyncUseCase,
|
||||
private val uiStrings: UiStringResolver,
|
||||
) {
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
|
||||
@@ -60,10 +57,7 @@ class StorageSyncBootstrap @Inject constructor(
|
||||
if (syncRunner.syncRunning.value) {
|
||||
return@collect
|
||||
}
|
||||
syncRunner.enqueue(
|
||||
displayTitle = uiStrings(R.string.task_title_storage_sync_background),
|
||||
reason = StorageSyncTriggerReason.Debounce,
|
||||
)
|
||||
syncRunner.enqueue(StorageSyncTriggerReason.Debounce)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.github.nullptroma.wallenc.app.sync
|
||||
|
||||
import com.github.nullptroma.wallenc.domain.tasks.IStorageSyncTaskTitleFormatter
|
||||
import com.github.nullptroma.wallenc.domain.tasks.StorageSyncTriggerReason
|
||||
import com.github.nullptroma.wallenc.ui.resources.UiStringResolver
|
||||
import com.github.nullptroma.wallenc.ui.resources.storageSyncTaskTitle
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class StorageSyncTaskTitleFormatter @Inject constructor(
|
||||
private val uiStrings: UiStringResolver,
|
||||
) : IStorageSyncTaskTitleFormatter {
|
||||
override fun format(reason: StorageSyncTriggerReason): String =
|
||||
uiStrings.storageSyncTaskTitle(reason)
|
||||
}
|
||||
Reference in New Issue
Block a user