forked from GitHub-Mirror/riotX-android
Merge pull request #389 from vector-im/feature/cleanup
Do not show invitation in the filtered room list
This commit is contained in:
commit
62657538af
@ -18,7 +18,7 @@ package im.vector.matrix.android.api.session.sync
|
||||
|
||||
sealed class SyncState {
|
||||
object IDLE : SyncState()
|
||||
data class RUNNING(val catchingUp: Boolean) : SyncState()
|
||||
data class RUNNING(val afterPause: Boolean) : SyncState()
|
||||
object PAUSED : SyncState()
|
||||
object KILLING : SyncState()
|
||||
object KILLED : SyncState()
|
||||
|
@ -37,7 +37,6 @@ import javax.inject.Inject
|
||||
|
||||
private const val RETRY_WAIT_TIME_MS = 10_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,
|
||||
private val networkConnectivityChecker: NetworkConnectivityChecker,
|
||||
@ -62,7 +61,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
||||
fun restart() = synchronized(lock) {
|
||||
if (state is SyncState.PAUSED) {
|
||||
Timber.v("Resume sync...")
|
||||
updateStateTo(SyncState.RUNNING(catchingUp = true))
|
||||
updateStateTo(SyncState.RUNNING(afterPause = true))
|
||||
lock.notify()
|
||||
}
|
||||
}
|
||||
@ -98,7 +97,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
||||
}
|
||||
} else {
|
||||
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")
|
||||
val latch = CountDownLatch(1)
|
||||
@ -140,11 +139,9 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
||||
|
||||
latch.await()
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class HomeDetailFragment : VectorBaseFragment(), KeysBackupBanner.Delegate {
|
||||
unreadCounterBadgeViews[INDEX_PEOPLE].render(UnreadCounterBadgeView.State(it.notificationCountPeople, it.notificationHighlightPeople))
|
||||
unreadCounterBadgeViews[INDEX_ROOMS].render(UnreadCounterBadgeView.State(it.notificationCountRooms, it.notificationHighlightRooms))
|
||||
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
|
||||
}
|
||||
syncProgressBarWrap.visibility = syncProgressBar.visibility
|
||||
|
@ -18,10 +18,6 @@ package im.vector.riotx.features.home
|
||||
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
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.Singleton
|
||||
|
||||
|
@ -18,8 +18,9 @@ package im.vector.riotx.features.home.room.list
|
||||
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import io.reactivex.functions.Predicate
|
||||
import javax.inject.Inject
|
||||
|
||||
class RoomListNameFilter : Predicate<RoomSummary> {
|
||||
class RoomListNameFilter @Inject constructor() : Predicate<RoomSummary> {
|
||||
|
||||
var filter: String = ""
|
||||
|
||||
|
@ -18,6 +18,7 @@ package im.vector.riotx.features.home.room.list
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
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.riotx.core.resources.StringProvider
|
||||
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
|
||||
|
||||
class RoomSummaryController @Inject constructor(private val stringProvider: StringProvider,
|
||||
private val roomSummaryItemFactory: RoomSummaryItemFactory
|
||||
private val roomSummaryItemFactory: RoomSummaryItemFactory,
|
||||
private val roomListNameFilter: RoomListNameFilter
|
||||
) : TypedEpoxyController<RoomListViewState>() {
|
||||
|
||||
var listener: Listener? = null
|
||||
|
||||
private val roomListNameFilter = RoomListNameFilter()
|
||||
|
||||
override fun buildModels(viewState: RoomListViewState) {
|
||||
if (viewState.displayMode == RoomListFragment.DisplayMode.FILTERED) {
|
||||
buildFilteredRooms(viewState)
|
||||
@ -62,7 +62,8 @@ class RoomSummaryController @Inject constructor(private val stringProvider: Stri
|
||||
|
||||
roomListNameFilter.filter = viewState.roomFilter
|
||||
|
||||
val filteredSummaries = summaries.filter { roomListNameFilter.test(it) }
|
||||
val filteredSummaries = summaries
|
||||
.filter { it.membership == Membership.JOIN && roomListNameFilter.test(it) }
|
||||
|
||||
buildRoomModels(filteredSummaries,
|
||||
viewState.joiningRoomsIds,
|
||||
|
Loading…
Reference in New Issue
Block a user