@@ -25,7 +25,6 @@ import androidx.work.WorkManager
25
25
import androidx.work.WorkQuery
26
26
import androidx.work.WorkRequest
27
27
import at.bitfire.davdroid.push.PushNotificationManager
28
- import at.bitfire.davdroid.repository.DavCollectionRepository
29
28
import at.bitfire.davdroid.sync.SyncDataType
30
29
import at.bitfire.davdroid.sync.TasksAppManager
31
30
import at.bitfire.davdroid.sync.worker.BaseSyncWorker.Companion.INPUT_ACCOUNT_NAME
@@ -37,13 +36,8 @@ import at.bitfire.davdroid.sync.worker.BaseSyncWorker.Companion.INPUT_UPLOAD
37
36
import at.bitfire.davdroid.sync.worker.BaseSyncWorker.Companion.InputResync
38
37
import at.bitfire.davdroid.sync.worker.BaseSyncWorker.Companion.NO_RESYNC
39
38
import at.bitfire.davdroid.sync.worker.BaseSyncWorker.Companion.commonTag
40
- import dagger.Binds
41
39
import dagger.Lazy
42
- import dagger.Module
43
- import dagger.hilt.InstallIn
44
40
import dagger.hilt.android.qualifiers.ApplicationContext
45
- import dagger.hilt.components.SingletonComponent
46
- import dagger.multibindings.IntoSet
47
41
import kotlinx.coroutines.flow.Flow
48
42
import kotlinx.coroutines.flow.map
49
43
import java.util.concurrent.TimeUnit
@@ -149,7 +143,7 @@ class SyncWorkerManager @Inject constructor(
149
143
}
150
144
WorkManager .getInstance(context).enqueueUniqueWork(
151
145
name,
152
- /* If sync is already running, just continue.
146
+ /* If sync is already running, continue that sync and don't append a new one .
153
147
Existing retried work will not be replaced (for instance when
154
148
PeriodicSyncWorker enqueues another scheduled sync). */
155
149
ExistingWorkPolicy .KEEP ,
@@ -291,28 +285,4 @@ class SyncWorkerManager @Inject constructor(
291
285
}
292
286
}
293
287
294
- /* *
295
- * Listener that enqueues a push registration worker when the collection list changes.
296
- */
297
- class CollectionsListener @Inject constructor(
298
- private val workerManager : SyncWorkerManager
299
- ): DavCollectionRepository.OnChangeListener {
300
-
301
- override fun onCollectionsChanged (account : Account ? ) {
302
- account?.let { workerManager.enqueueOneTimeAllAuthorities(it) }
303
- }
304
-
305
- }
306
-
307
- /* *
308
- * Hilt module that registers [CollectionsListener] in [DavCollectionRepository].
309
- */
310
- @Module
311
- @InstallIn(SingletonComponent ::class )
312
- interface SyncWorkerManagerModule {
313
- @Binds
314
- @IntoSet
315
- fun listener (impl : CollectionsListener ): DavCollectionRepository .OnChangeListener
316
- }
317
-
318
288
}
0 commit comments