forked from upstream-mirrors/quik
Ensure that MMS have unique keys
This commit is contained in:
@@ -18,16 +18,21 @@
|
||||
*/
|
||||
package interactor
|
||||
|
||||
import common.util.Keys
|
||||
import common.util.SyncManager
|
||||
import io.reactivex.Flowable
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
class FullSync @Inject constructor(private val syncManager: SyncManager) : Interactor<Unit, Long>() {
|
||||
class FullSync @Inject constructor(
|
||||
private val syncManager: SyncManager,
|
||||
private val keys: Keys
|
||||
) : Interactor<Unit, Long>() {
|
||||
|
||||
override fun buildObservable(params: Unit): Flowable<Long> {
|
||||
return Flowable.just(System.currentTimeMillis())
|
||||
.doOnNext { keys.reset() }
|
||||
.doOnNext { syncManager.performSync(true) }
|
||||
.map { startTime -> System.currentTimeMillis() - startTime }
|
||||
.map { elapsed -> TimeUnit.MILLISECONDS.toSeconds(elapsed) }
|
||||
|
||||
@@ -36,7 +36,6 @@ open class PartialSync @Inject constructor(
|
||||
return Flowable.just(System.currentTimeMillis())
|
||||
.skipWhile { !permissions.hasSmsAndContacts() }
|
||||
.doOnNext { syncManager.performSync() }
|
||||
.doOnNext { keys.refresh() }
|
||||
.map { startTime -> System.currentTimeMillis() - startTime }
|
||||
.map { elapsed -> TimeUnit.MILLISECONDS.toSeconds(elapsed) }
|
||||
.doOnNext { seconds -> Timber.v("Completed sync in $seconds seconds") }
|
||||
|
||||
Reference in New Issue
Block a user