mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
@@ -21,7 +21,6 @@ package com.moez.QKSMS.interactor
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
class SyncContacts @Inject constructor(private val syncManager: SyncRepository) : Interactor<Unit>() {
|
||||
@@ -30,8 +29,7 @@ class SyncContacts @Inject constructor(private val syncManager: SyncRepository)
|
||||
return Flowable.just(System.currentTimeMillis())
|
||||
.doOnNext { syncManager.syncContacts() }
|
||||
.map { startTime -> System.currentTimeMillis() - startTime }
|
||||
.map { elapsed -> TimeUnit.MILLISECONDS.toSeconds(elapsed) }
|
||||
.doOnNext { seconds -> Timber.v("Completed sync in $seconds seconds") }
|
||||
.doOnNext { duration -> Timber.v("Completed sync in ${duration}ms") }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,6 @@ import io.reactivex.Observable
|
||||
|
||||
interface ContactAddedListener {
|
||||
|
||||
fun listen(address: String): Observable<*>
|
||||
fun listen(): Observable<*>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.reactivex.Observable
|
||||
interface SyncRepository {
|
||||
|
||||
sealed class SyncProgress {
|
||||
class Idle : SyncProgress()
|
||||
object Idle : SyncProgress()
|
||||
data class Running(val max: Int, val progress: Int, val indeterminate: Boolean) : SyncProgress()
|
||||
}
|
||||
|
||||
@@ -37,11 +37,4 @@ interface SyncRepository {
|
||||
|
||||
fun syncContacts()
|
||||
|
||||
/**
|
||||
* Syncs a single contact to the Realm
|
||||
*
|
||||
* Return false if the contact couldn't be found
|
||||
*/
|
||||
fun syncContact(address: String): Boolean
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user