mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 20:29:10 +03:00
Merge branch 'develop' into feature/bma/sdk_doc_update
This commit is contained in:
commit
6ee0b62272
15 changed files with 58 additions and 81 deletions
2
.github/workflows/update-gradle-wrapper.yml
vendored
2
.github/workflows/update-gradle-wrapper.yml
vendored
|
@ -13,6 +13,8 @@ jobs:
|
|||
|
||||
- name: Update Gradle Wrapper
|
||||
uses: gradle-update/update-gradle-wrapper-action@v1
|
||||
# Skip in forks
|
||||
if: github.repository == 'vector-im/element-android'
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
target-branch: develop
|
||||
|
|
|
@ -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)
|
||||
=======================================
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ buildscript {
|
|||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
|
||||
classpath "com.likethesalad.android:stem-plugin:2.0.0"
|
||||
classpath 'org.owasp:dependency-check-gradle:7.0.4.1'
|
||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.20"
|
||||
classpath 'org.owasp:dependency-check-gradle:7.1.0.1'
|
||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.21"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
|
1
changelog.d/5814.feature
Normal file
1
changelog.d/5814.feature
Normal file
|
@ -0,0 +1 @@
|
|||
Live location sharing: updating beacon state event content structure
|
2
fastlane/metadata/android/en-US/changelogs/40104130.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/40104130.txt
Normal 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
|
|
@ -478,7 +478,9 @@ class SpaceHierarchyTest : InstrumentedTest {
|
|||
// + C
|
||||
// + 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)
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.api.session.room.model.livelocation
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class BeaconInfo(
|
||||
@Json(name = "description") val description: String? = null,
|
||||
/**
|
||||
* Beacon should be considered as inactive after this timeout as milliseconds.
|
||||
*/
|
||||
@Json(name = "timeout") val timeout: Long? = null,
|
||||
/**
|
||||
* Should be set true to start sharing beacon.
|
||||
*/
|
||||
@Json(name = "live") val isLive: Boolean? = null
|
||||
)
|
|
@ -39,10 +39,18 @@ data class LiveLocationBeaconContent(
|
|||
@Json(name = "m.new_content") override val newContent: Content? = null,
|
||||
|
||||
/**
|
||||
* Indicates user's intent to share ephemeral location.
|
||||
* Optional description of the beacon.
|
||||
*/
|
||||
@Json(name = "org.matrix.msc3672.beacon_info") val unstableBeaconInfo: BeaconInfo? = null,
|
||||
@Json(name = "m.beacon_info") val beaconInfo: BeaconInfo? = null,
|
||||
@Json(name = "description") val description: String? = null,
|
||||
/**
|
||||
* Beacon should be considered as inactive after this timeout as milliseconds.
|
||||
*/
|
||||
@Json(name = "timeout") val timeout: Long? = null,
|
||||
/**
|
||||
* Should be set true to start sharing beacon.
|
||||
*/
|
||||
@Json(name = "live") val isLive: Boolean? = null,
|
||||
|
||||
/**
|
||||
* Beacon creation timestamp.
|
||||
*/
|
||||
|
@ -65,8 +73,6 @@ data class LiveLocationBeaconContent(
|
|||
var hasTimedOut: Boolean = false
|
||||
) : MessageContent {
|
||||
|
||||
fun getBestBeaconInfo() = beaconInfo ?: unstableBeaconInfo
|
||||
|
||||
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
|
||||
|
||||
fun getBestLocationAsset() = locationAsset ?: unstableLocationAsset
|
||||
|
|
|
@ -106,5 +106,8 @@ interface SpaceService {
|
|||
|
||||
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>
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
|
|||
}
|
||||
|
||||
// Check if live location is ended
|
||||
if (!beaconInfoContent.getBestBeaconInfo()?.isLive.orFalse()) {
|
||||
if (!beaconInfoContent.isLive.orFalse()) {
|
||||
Timber.v("## LIVE LOCATION. Beacon info is not live anymore")
|
||||
return
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
|
|||
liveLocationContent: MessageLiveLocationContent): Boolean {
|
||||
val beaconInfoStartTime = beaconInfoContent.getBestTimestampAsMilliseconds() ?: 0
|
||||
val liveLocationEventTime = liveLocationContent.getBestTimestampAsMilliseconds() ?: 0
|
||||
val timeout = beaconInfoContent.getBestBeaconInfo()?.timeout ?: 0
|
||||
val timeout = beaconInfoContent.timeout ?: 0
|
||||
return liveLocationEventTime - beaconInfoStartTime > timeout
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
|
|||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesAllowEntry
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomJoinRulesContent
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.BeaconInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationBeaconContent
|
||||
import org.matrix.android.sdk.api.session.room.state.StateService
|
||||
import org.matrix.android.sdk.api.util.JsonDict
|
||||
|
@ -194,19 +193,12 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
|||
override suspend fun stopLiveLocation(userId: String) {
|
||||
getLiveLocationBeaconInfo(userId, true)?.let { beaconInfoStateEvent ->
|
||||
beaconInfoStateEvent.getClearContent()?.toModel<LiveLocationBeaconContent>()?.let { content ->
|
||||
val beaconContent = LiveLocationBeaconContent(
|
||||
unstableBeaconInfo = BeaconInfo(
|
||||
description = content.getBestBeaconInfo()?.description,
|
||||
timeout = content.getBestBeaconInfo()?.timeout,
|
||||
isLive = false,
|
||||
),
|
||||
unstableTimestampAsMilliseconds = System.currentTimeMillis()
|
||||
).toContent()
|
||||
val updatedContent = content.copy(isLive = false).toContent()
|
||||
|
||||
beaconInfoStateEvent.stateKey?.let {
|
||||
sendStateEvent(
|
||||
eventType = EventType.STATE_ROOM_BEACON_INFO.first(),
|
||||
body = beaconContent,
|
||||
body = updatedContent,
|
||||
stateKey = it
|
||||
)
|
||||
}
|
||||
|
@ -225,7 +217,7 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
|||
}
|
||||
.firstOrNull { beaconInfoEvent ->
|
||||
!filterOnlyLive ||
|
||||
beaconInfoEvent.getClearContent()?.toModel<LiveLocationBeaconContent>()?.getBestBeaconInfo()?.isLive.orFalse()
|
||||
beaconInfoEvent.getClearContent()?.toModel<LiveLocationBeaconContent>()?.isLive.orFalse()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.matrix.android.sdk.internal.session.space
|
|||
|
||||
import android.net.Uri
|
||||
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.session.events.model.Event
|
||||
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 peekSpaceTask: PeekSpaceTask,
|
||||
private val resolveSpaceInfoTask: ResolveSpaceInfoTask,
|
||||
private val leaveRoomTask: LeaveRoomTask
|
||||
private val leaveRoomTask: LeaveRoomTask,
|
||||
private val coroutineDispatchers: MatrixCoroutineDispatchers,
|
||||
) : SpaceService {
|
||||
|
||||
override suspend fun createSpace(params: CreateSpaceParams): String {
|
||||
|
@ -105,8 +108,10 @@ internal class DefaultSpaceService @Inject constructor(
|
|||
return roomSummaryDataSource.getSpaceSummaries(spaceSummaryQueryParams, sortOrder)
|
||||
}
|
||||
|
||||
override fun getRootSpaceSummaries(): List<RoomSummary> {
|
||||
return roomSummaryDataSource.getRootSpaceSummaries()
|
||||
override suspend fun getRootSpaceSummaries(): List<RoomSummary> {
|
||||
return withContext(coroutineDispatchers.io) {
|
||||
roomSummaryDataSource.getRootSpaceSummaries()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun peekSpace(spaceId: String): SpacePeekResult {
|
||||
|
|
|
@ -46,7 +46,7 @@ class LiveLocationMessageItemFactory @Inject constructor(
|
|||
}
|
||||
|
||||
private fun isLiveRunning(liveLocationContent: LiveLocationBeaconContent): Boolean {
|
||||
return liveLocationContent.getBestBeaconInfo()?.isLive.orFalse() && liveLocationContent.hasTimedOut.not()
|
||||
return liveLocationContent.isLive.orFalse() && liveLocationContent.hasTimedOut.not()
|
||||
}
|
||||
|
||||
private fun buildStartLiveItem(
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.matrix.android.sdk.api.session.Session
|
|||
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||
import org.matrix.android.sdk.api.session.events.model.toContent
|
||||
import org.matrix.android.sdk.api.session.getRoom
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.BeaconInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationBeaconContent
|
||||
import timber.log.Timber
|
||||
import java.util.Timer
|
||||
|
@ -98,10 +97,8 @@ class LocationSharingService : VectorService(), LocationTracker.Callback {
|
|||
|
||||
private suspend fun sendLiveBeaconInfo(session: Session, roomArgs: RoomArgs) {
|
||||
val beaconContent = LiveLocationBeaconContent(
|
||||
unstableBeaconInfo = BeaconInfo(
|
||||
timeout = roomArgs.durationMillis,
|
||||
isLive = true
|
||||
),
|
||||
timeout = roomArgs.durationMillis,
|
||||
isLive = true,
|
||||
unstableTimestampAsMilliseconds = clock.epochMillis()
|
||||
).toContent()
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import kotlinx.coroutines.flow.combine
|
|||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.flow.sample
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -213,7 +212,8 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
|
|||
}
|
||||
session.coroutineScope.launch {
|
||||
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()
|
||||
)
|
||||
}
|
||||
|
@ -279,31 +279,23 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
|
|||
displayName = QueryStringValue.IsNotEmpty
|
||||
}
|
||||
|
||||
val flowSession = session.flow()
|
||||
|
||||
combine(
|
||||
flowSession
|
||||
.liveUser(session.myUserId)
|
||||
.map {
|
||||
it.getOrNull()
|
||||
},
|
||||
flowSession
|
||||
session.flow()
|
||||
.liveSpaceSummaries(params),
|
||||
session
|
||||
.accountDataService()
|
||||
session.accountDataService()
|
||||
.getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))
|
||||
.asFlow()
|
||||
) { _, communityGroups, _ ->
|
||||
communityGroups
|
||||
) { spaces, _ ->
|
||||
spaces
|
||||
}
|
||||
.execute { async ->
|
||||
val rootSpaces = session.spaceService().getRootSpaceSummaries()
|
||||
val orders = rootSpaces.map {
|
||||
val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
|
||||
val orders = rootSpaces.associate {
|
||||
it.roomId to session.getRoom(it.roomId)
|
||||
?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)
|
||||
?.content.toModel<SpaceOrderContent>()
|
||||
?.safeOrder()
|
||||
}.toMap()
|
||||
}
|
||||
copy(
|
||||
asyncSpaces = async,
|
||||
rootSpacesOrdered = rootSpaces.sortedWith(TopLevelSpaceComparator(orders)),
|
||||
|
|
Loading…
Add table
Reference in a new issue