Merge branch 'hotfix/1.4.13' into main

This commit is contained in:
Benoit Marty 2022-04-26 11:47:11 +02:00
commit 6059b71015
8 changed files with 36 additions and 24 deletions

View File

@ -1,3 +1,11 @@
Changes in Element 1.4.13 (2022-04-26)
======================================
Bugfixes 🐛
----------
- Fix UI freeze observed after each incremental sync ([#5835](https://github.com/vector-im/element-android/issues/5835))
Changes in Element v1.4.12 (2022-04-20) Changes in Element v1.4.12 (2022-04-20)
======================================= =======================================

View File

@ -0,0 +1,2 @@
Main changes in this version: Allows users to appear offline and adds an audio player for audio attachments
Full changelog: https://github.com/vector-im/element-android/releases

View File

@ -32,7 +32,7 @@ android {
// that the app's state is completely cleared between tests. // that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true' testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "String", "SDK_VERSION", "\"1.4.12\"" buildConfigField "String", "SDK_VERSION", "\"1.4.13\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\"" buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""

View File

@ -475,7 +475,9 @@ class SpaceHierarchyTest : InstrumentedTest {
// + C // + C
// + c1, c2 // + c1, c2
val rootSpaces = session.spaceService().getRootSpaceSummaries() val rootSpaces = commonTestHelper.runBlockingTest {
session.spaceService().getRootSpaceSummaries()
}
assertEquals("Unexpected number of root spaces ${rootSpaces.map { it.name }}", 2, rootSpaces.size) assertEquals("Unexpected number of root spaces ${rootSpaces.map { it.name }}", 2, rootSpaces.size)

View File

@ -106,5 +106,8 @@ interface SpaceService {
suspend fun removeSpaceParent(childRoomId: String, parentSpaceId: String) suspend fun removeSpaceParent(childRoomId: String, parentSpaceId: String)
fun getRootSpaceSummaries(): List<RoomSummary> /**
* Get the root spaces, i.e. all the spaces which do not have a parent space.
*/
suspend fun getRootSpaceSummaries(): List<RoomSummary>
} }

View File

@ -18,6 +18,8 @@ package org.matrix.android.sdk.internal.session.space
import android.net.Uri import android.net.Uri
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import kotlinx.coroutines.withContext
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
import org.matrix.android.sdk.api.query.QueryStringValue import org.matrix.android.sdk.api.query.QueryStringValue
import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType import org.matrix.android.sdk.api.session.events.model.EventType
@ -64,7 +66,8 @@ internal class DefaultSpaceService @Inject constructor(
private val stateEventDataSource: StateEventDataSource, private val stateEventDataSource: StateEventDataSource,
private val peekSpaceTask: PeekSpaceTask, private val peekSpaceTask: PeekSpaceTask,
private val resolveSpaceInfoTask: ResolveSpaceInfoTask, private val resolveSpaceInfoTask: ResolveSpaceInfoTask,
private val leaveRoomTask: LeaveRoomTask private val leaveRoomTask: LeaveRoomTask,
private val coroutineDispatchers: MatrixCoroutineDispatchers,
) : SpaceService { ) : SpaceService {
override suspend fun createSpace(params: CreateSpaceParams): String { override suspend fun createSpace(params: CreateSpaceParams): String {
@ -105,8 +108,10 @@ internal class DefaultSpaceService @Inject constructor(
return roomSummaryDataSource.getSpaceSummaries(spaceSummaryQueryParams, sortOrder) return roomSummaryDataSource.getSpaceSummaries(spaceSummaryQueryParams, sortOrder)
} }
override fun getRootSpaceSummaries(): List<RoomSummary> { override suspend fun getRootSpaceSummaries(): List<RoomSummary> {
return roomSummaryDataSource.getRootSpaceSummaries() return withContext(coroutineDispatchers.io) {
roomSummaryDataSource.getRootSpaceSummaries()
}
} }
override suspend fun peekSpace(spaceId: String): SpacePeekResult { override suspend fun peekSpace(spaceId: String): SpacePeekResult {

View File

@ -18,7 +18,7 @@ ext.versionMinor = 4
// Note: even values are reserved for regular release, odd values for hotfix release. // Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value // When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release. // is the value for the next regular release.
ext.versionPatch = 12 ext.versionPatch = 13
static def getGitTimestamp() { static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct' def cmd = 'git show -s --format=%ct'

View File

@ -40,7 +40,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.sample import kotlinx.coroutines.flow.sample
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -212,7 +211,8 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
} }
session.coroutineScope.launch { session.coroutineScope.launch {
orderCommands.forEach { orderCommands.forEach {
session.getRoom(it.spaceId)?.updateAccountData(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER, session.getRoom(it.spaceId)?.updateAccountData(
RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER,
SpaceOrderContent(order = it.order).toContent() SpaceOrderContent(order = it.order).toContent()
) )
} }
@ -278,31 +278,23 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
displayName = QueryStringValue.IsNotEmpty displayName = QueryStringValue.IsNotEmpty
} }
val flowSession = session.flow()
combine( combine(
flowSession session.flow()
.liveUser(session.myUserId)
.map {
it.getOrNull()
},
flowSession
.liveSpaceSummaries(params), .liveSpaceSummaries(params),
session session.accountDataService()
.accountDataService()
.getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)) .getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))
.asFlow() .asFlow()
) { _, communityGroups, _ -> ) { spaces, _ ->
communityGroups spaces
} }
.execute { async -> .execute { async ->
val rootSpaces = session.spaceService().getRootSpaceSummaries() val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
val orders = rootSpaces.map { val orders = rootSpaces.associate {
it.roomId to session.getRoom(it.roomId) it.roomId to session.getRoom(it.roomId)
?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER) ?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)
?.content.toModel<SpaceOrderContent>() ?.content.toModel<SpaceOrderContent>()
?.safeOrder() ?.safeOrder()
}.toMap() }
copy( copy(
asyncSpaces = async, asyncSpaces = async,
rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)), rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)),