diff --git a/CHANGES.md b/CHANGES.md index cd6ffe9995..33d749a7e9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,10 +8,14 @@ Features ✨: Improvements 🙌: - New wording for notice when current user is the sender - Hide "X made no changes" event by default in timeline (#1430) + - Hide left rooms in breadcrumbs (#766) Bugfix 🐛: - Switch theme is not fully taken into account without restarting the app - Temporary fix to show error when user is creating an account on matrix.org with userId containing only digits (#1410) + - Reply composer overlay stays on screen too long after send (#1169) + - Fix navigation bar icon contrast on API in [21,27[ (#1342) + - Fix status bar icon contrast on API in [21,23[ Translations 🗣: - diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt index d2d9eb4d5a..e8fef1361d 100644 --- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt +++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt @@ -29,6 +29,7 @@ import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams import im.vector.matrix.android.api.session.sync.SyncState import im.vector.matrix.android.api.session.user.model.User +import im.vector.matrix.android.api.session.widgets.model.Widget import im.vector.matrix.android.api.util.JsonDict import im.vector.matrix.android.api.util.Optional import im.vector.matrix.android.api.util.toOptional @@ -36,7 +37,6 @@ import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo import im.vector.matrix.android.internal.crypto.model.rest.DeviceInfo import im.vector.matrix.android.internal.crypto.store.PrivateKeysInfo import im.vector.matrix.android.internal.session.sync.model.accountdata.UserAccountDataEvent -import im.vector.matrix.android.api.session.widgets.model.Widget import io.reactivex.Observable import io.reactivex.Single @@ -56,10 +56,10 @@ class RxSession(private val session: Session) { } } - fun liveBreadcrumbs(): Observable> { - return session.getBreadcrumbsLive().asObservable() + fun liveBreadcrumbs(queryParams: RoomSummaryQueryParams): Observable> { + return session.getBreadcrumbsLive(queryParams).asObservable() .startWithCallable { - session.getBreadcrumbs() + session.getBreadcrumbs(queryParams) } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/RoomService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/RoomService.kt index 93761dfd26..bc6c17a130 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/RoomService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/RoomService.kt @@ -73,15 +73,17 @@ interface RoomService { /** * Get a snapshot list of Breadcrumbs + * @param queryParams parameters to query the room summaries. It can be use to keep only joined rooms, for instance. * @return the immutable list of [RoomSummary] */ - fun getBreadcrumbs(): List + fun getBreadcrumbs(queryParams: RoomSummaryQueryParams): List /** * Get a live list of Breadcrumbs + * @param queryParams parameters to query the room summaries. It can be use to keep only joined rooms, for instance. * @return the [LiveData] of [RoomSummary] */ - fun getBreadcrumbsLive(): LiveData> + fun getBreadcrumbsLive(queryParams: RoomSummaryQueryParams): LiveData> /** * Inform the Matrix SDK that a room is displayed. diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt index 84fc357160..8868ab4fe1 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt @@ -111,24 +111,22 @@ internal class DefaultRoomService @Inject constructor( return query } - override fun getBreadcrumbs(): List { + override fun getBreadcrumbs(queryParams: RoomSummaryQueryParams): List { return monarchy.fetchAllMappedSync( - { breadcrumbsQuery(it) }, + { breadcrumbsQuery(it, queryParams) }, { roomSummaryMapper.map(it) } ) } - override fun getBreadcrumbsLive(): LiveData> { + override fun getBreadcrumbsLive(queryParams: RoomSummaryQueryParams): LiveData> { return monarchy.findAllMappedWithChanges( - { breadcrumbsQuery(it) }, + { breadcrumbsQuery(it, queryParams) }, { roomSummaryMapper.map(it) } ) } - private fun breadcrumbsQuery(realm: Realm): RealmQuery { - return RoomSummaryEntity.where(realm) - .isNotEmpty(RoomSummaryEntityFields.DISPLAY_NAME) - .notEqualTo(RoomSummaryEntityFields.VERSIONING_STATE_STR, VersioningState.UPGRADED_ROOM_JOINED.name) + private fun breadcrumbsQuery(realm: Realm, queryParams: RoomSummaryQueryParams): RealmQuery { + return roomSummariesQuery(realm, queryParams) .greaterThan(RoomSummaryEntityFields.BREADCRUMBS_INDEX, RoomSummary.NOT_IN_BREADCRUMBS) .sort(RoomSummaryEntityFields.BREADCRUMBS_INDEX) } diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt index f8a1e302af..2e847176ff 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/breadcrumbs/BreadcrumbsViewModel.kt @@ -21,7 +21,10 @@ import com.airbnb.mvrx.MvRxViewModelFactory import com.airbnb.mvrx.ViewModelContext import com.squareup.inject.assisted.Assisted import com.squareup.inject.assisted.AssistedInject +import im.vector.matrix.android.api.query.QueryStringValue import im.vector.matrix.android.api.session.Session +import im.vector.matrix.android.api.session.room.model.Membership +import im.vector.matrix.android.api.session.room.roomSummaryQueryParams import im.vector.matrix.rx.rx import im.vector.riotx.core.platform.EmptyAction import im.vector.riotx.core.platform.EmptyViewEvents @@ -58,7 +61,10 @@ class BreadcrumbsViewModel @AssistedInject constructor(@Assisted initialState: B private fun observeBreadcrumbs() { session.rx() - .liveBreadcrumbs() + .liveBreadcrumbs(roomSummaryQueryParams { + displayName = QueryStringValue.NoCondition + memberships = listOf(Membership.JOIN) + }) .observeOn(Schedulers.computation()) .execute { asyncBreadcrumbs -> copy(asyncBreadcrumbs = asyncBreadcrumbs) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index b6d3949b5c..d2e86bf706 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -682,6 +682,8 @@ class RoomDetailFragment @Inject constructor( return } if (text.isNotBlank()) { + // We collapse ASAP, if not there will be a slight anoying delay + composerLayout.collapse(true) lockSendButton = true roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled())) } diff --git a/vector/src/main/res/values-v21/theme_light.xml b/vector/src/main/res/values-v21/theme_light.xml index d5a31ad36f..8f52615316 100644 --- a/vector/src/main/res/values-v21/theme_light.xml +++ b/vector/src/main/res/values-v21/theme_light.xml @@ -2,8 +2,10 @@ diff --git a/vector/src/main/res/values-v23/theme_status.xml b/vector/src/main/res/values-v23/theme_status.xml index 054e9fcbc1..b2e12ab55d 100644 --- a/vector/src/main/res/values-v23/theme_status.xml +++ b/vector/src/main/res/values-v23/theme_status.xml @@ -2,7 +2,8 @@ diff --git a/vector/src/main/res/values-v27/theme_status.xml b/vector/src/main/res/values-v27/theme_status.xml index 3c72ede37d..f29383f8a3 100644 --- a/vector/src/main/res/values-v27/theme_status.xml +++ b/vector/src/main/res/values-v27/theme_status.xml @@ -2,6 +2,7 @@