Rename class member for code clarity

This commit is contained in:
Benoit Marty 2019-07-18 11:07:09 +02:00
parent 49ae954183
commit 0afde3b021
3 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ package im.vector.matrix.android.api.session.sync


sealed class SyncState { sealed class SyncState {
object IDLE : SyncState() object IDLE : SyncState()
data class RUNNING(val catchingUp: Boolean) : SyncState() data class RUNNING(val afterPause: Boolean) : SyncState()
object PAUSED : SyncState() object PAUSED : SyncState()
object KILLING : SyncState() object KILLING : SyncState()
object KILLED : SyncState() object KILLED : SyncState()

View File

@ -62,7 +62,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
fun restart() = synchronized(lock) { fun restart() = synchronized(lock) {
if (state is SyncState.PAUSED) { if (state is SyncState.PAUSED) {
Timber.v("Resume sync...") Timber.v("Resume sync...")
updateStateTo(SyncState.RUNNING(catchingUp = true)) updateStateTo(SyncState.RUNNING(afterPause = true))
lock.notify() lock.notify()
} }
} }
@ -98,7 +98,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
} }
} else { } else {
if (state !is SyncState.RUNNING) { if (state !is SyncState.RUNNING) {
updateStateTo(SyncState.RUNNING(catchingUp = true)) updateStateTo(SyncState.RUNNING(afterPause = true))
} }
Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT") Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT")
val latch = CountDownLatch(1) val latch = CountDownLatch(1)
@ -140,7 +140,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,


latch.await() latch.await()
if (state is SyncState.RUNNING) { if (state is SyncState.RUNNING) {
updateStateTo(SyncState.RUNNING(catchingUp = false)) updateStateTo(SyncState.RUNNING(afterPause = false))
} }


Timber.v("Waiting for $DEFAULT_LONG_POOL_DELAY delay before new pool...") Timber.v("Waiting for $DEFAULT_LONG_POOL_DELAY delay before new pool...")

View File

@ -209,7 +209,7 @@ class HomeDetailFragment : VectorBaseFragment(), KeysBackupBanner.Delegate {
unreadCounterBadgeViews[INDEX_PEOPLE].render(UnreadCounterBadgeView.State(it.notificationCountPeople, it.notificationHighlightPeople)) unreadCounterBadgeViews[INDEX_PEOPLE].render(UnreadCounterBadgeView.State(it.notificationCountPeople, it.notificationHighlightPeople))
unreadCounterBadgeViews[INDEX_ROOMS].render(UnreadCounterBadgeView.State(it.notificationCountRooms, it.notificationHighlightRooms)) unreadCounterBadgeViews[INDEX_ROOMS].render(UnreadCounterBadgeView.State(it.notificationCountRooms, it.notificationHighlightRooms))
syncProgressBar.visibility = when (it.syncState) { syncProgressBar.visibility = when (it.syncState) {
is SyncState.RUNNING -> if (it.syncState.catchingUp) View.VISIBLE else View.GONE is SyncState.RUNNING -> if (it.syncState.afterPause) View.VISIBLE else View.GONE
else -> View.GONE else -> View.GONE
} }
syncProgressBarWrap.visibility = syncProgressBar.visibility syncProgressBarWrap.visibility = syncProgressBar.visibility