Merge pull request #389 from vector-im/feature/cleanup

Do not show invitation in the filtered room list
This commit is contained in:
ganfra 2019-07-18 12:10:47 +02:00 committed by GitHub
commit 62657538af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 17 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

@ -37,7 +37,6 @@ import javax.inject.Inject


private const val RETRY_WAIT_TIME_MS = 10_000L private const val RETRY_WAIT_TIME_MS = 10_000L
private const val DEFAULT_LONG_POOL_TIMEOUT = 30_000L private const val DEFAULT_LONG_POOL_TIMEOUT = 30_000L
private const val DEFAULT_LONG_POOL_DELAY = 0L


internal class SyncThread @Inject constructor(private val syncTask: SyncTask, internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
private val networkConnectivityChecker: NetworkConnectivityChecker, private val networkConnectivityChecker: NetworkConnectivityChecker,
@ -62,7 +61,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 +97,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,11 +139,9 @@ 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...")
if (DEFAULT_LONG_POOL_DELAY > 0) sleep(DEFAULT_LONG_POOL_DELAY)
Timber.v("...Continue") Timber.v("...Continue")
} }
} }

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

View File

@ -18,10 +18,6 @@ package im.vector.riotx.features.home


import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.riotx.core.utils.RxStore import im.vector.riotx.core.utils.RxStore
import im.vector.riotx.features.home.room.list.RoomListDisplayModeFilter
import im.vector.riotx.features.home.room.list.RoomListFragment
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton



View File

@ -18,8 +18,9 @@ package im.vector.riotx.features.home.room.list


import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.RoomSummary
import io.reactivex.functions.Predicate import io.reactivex.functions.Predicate
import javax.inject.Inject


class RoomListNameFilter : Predicate<RoomSummary> { class RoomListNameFilter @Inject constructor() : Predicate<RoomSummary> {


var filter: String = "" var filter: String = ""



View File

@ -18,6 +18,7 @@ package im.vector.riotx.features.home.room.list


import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.airbnb.epoxy.TypedEpoxyController import com.airbnb.epoxy.TypedEpoxyController
import im.vector.matrix.android.api.session.room.model.Membership
import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.riotx.core.resources.StringProvider import im.vector.riotx.core.resources.StringProvider
import im.vector.riotx.features.home.room.filtered.FilteredRoomFooterItem import im.vector.riotx.features.home.room.filtered.FilteredRoomFooterItem
@ -25,13 +26,12 @@ import im.vector.riotx.features.home.room.filtered.filteredRoomFooterItem
import javax.inject.Inject import javax.inject.Inject


class RoomSummaryController @Inject constructor(private val stringProvider: StringProvider, class RoomSummaryController @Inject constructor(private val stringProvider: StringProvider,
private val roomSummaryItemFactory: RoomSummaryItemFactory private val roomSummaryItemFactory: RoomSummaryItemFactory,
private val roomListNameFilter: RoomListNameFilter
) : TypedEpoxyController<RoomListViewState>() { ) : TypedEpoxyController<RoomListViewState>() {


var listener: Listener? = null var listener: Listener? = null


private val roomListNameFilter = RoomListNameFilter()

override fun buildModels(viewState: RoomListViewState) { override fun buildModels(viewState: RoomListViewState) {
if (viewState.displayMode == RoomListFragment.DisplayMode.FILTERED) { if (viewState.displayMode == RoomListFragment.DisplayMode.FILTERED) {
buildFilteredRooms(viewState) buildFilteredRooms(viewState)
@ -62,7 +62,8 @@ class RoomSummaryController @Inject constructor(private val stringProvider: Stri


roomListNameFilter.filter = viewState.roomFilter roomListNameFilter.filter = viewState.roomFilter


val filteredSummaries = summaries.filter { roomListNameFilter.test(it) } val filteredSummaries = summaries
.filter { it.membership == Membership.JOIN && roomListNameFilter.test(it) }


buildRoomModels(filteredSummaries, buildRoomModels(filteredSummaries,
viewState.joiningRoomsIds, viewState.joiningRoomsIds,