From 914db8c6be84375975da0989182f2394ca5f7e8e Mon Sep 17 00:00:00 2001
From: Maxime NATUREL <maxime.naturel@niji.fr>
Date: Thu, 21 Apr 2022 15:52:16 +0200
Subject: [PATCH 01/15] Removing BeaconInfo structure

---
 .../room/model/livelocation/BeaconInfo.kt     | 33 -------------------
 .../livelocation/LiveLocationBeaconContent.kt | 16 ++++++---
 ...DefaultLiveLocationAggregationProcessor.kt |  4 +--
 .../session/room/state/DefaultStateService.kt | 14 ++------
 .../factory/LiveLocationMessageItemFactory.kt |  2 +-
 .../location/LocationSharingService.kt        |  7 ++--
 6 files changed, 19 insertions(+), 57 deletions(-)
 delete mode 100644 matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/BeaconInfo.kt

diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/BeaconInfo.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/BeaconInfo.kt
deleted file mode 100644
index 873edc0f1f..0000000000
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/BeaconInfo.kt
+++ /dev/null
@@ -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
-)
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationBeaconContent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationBeaconContent.kt
index 106e76eafd..a7c78f6e80 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationBeaconContent.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationBeaconContent.kt
@@ -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
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt
index 95e196c762..8de0965b40 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/aggregation/livelocation/DefaultLiveLocationAggregationProcessor.kt
@@ -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
     }
 }
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt
index 89d33f98d2..0a4fd875d5 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/state/DefaultStateService.kt
@@ -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()
                 }
     }
 }
diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationMessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationMessageItemFactory.kt
index 9bc148a562..c417038935 100644
--- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationMessageItemFactory.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/LiveLocationMessageItemFactory.kt
@@ -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(
diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt
index 2126cdac04..4e0980173b 100644
--- a/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt
+++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt
@@ -31,7 +31,6 @@ import kotlinx.parcelize.Parcelize
 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.room.model.livelocation.BeaconInfo
 import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationBeaconContent
 import timber.log.Timber
 import java.util.Timer
@@ -97,10 +96,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()
 

From eb844753a55f6ce0341dc5665c4cbafe474c189f Mon Sep 17 00:00:00 2001
From: Maxime NATUREL <maxime.naturel@niji.fr>
Date: Thu, 21 Apr 2022 16:47:38 +0200
Subject: [PATCH 02/15] Adding changelog entry

---
 changelog.d/5814.feature | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 changelog.d/5814.feature

diff --git a/changelog.d/5814.feature b/changelog.d/5814.feature
new file mode 100644
index 0000000000..c892702486
--- /dev/null
+++ b/changelog.d/5814.feature
@@ -0,0 +1 @@
+Live location sharing: updating beacon state event content structure

From cd06ba656aa53cc1a4bab7284d6db4563904a528 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 25 Apr 2022 16:07:19 +0200
Subject: [PATCH 03/15] Ensure `getRootSpaceSummaries()` is not called on the
 main thread.

---
 .../android/sdk/session/space/SpaceHierarchyTest.kt   |  4 +++-
 .../android/sdk/api/session/space/SpaceService.kt     |  5 ++++-
 .../sdk/internal/session/space/DefaultSpaceService.kt | 11 ++++++++---
 .../vector/app/features/spaces/SpaceListViewModel.kt  |  2 +-
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt
index 20faa81bb6..50e4a6feb6 100644
--- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/space/SpaceHierarchyTest.kt
@@ -475,7 +475,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)
 
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt
index f4460b7659..7826764067 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt
@@ -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>
 }
diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt
index 05cff7dd89..355039b22c 100644
--- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt
+++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt
@@ -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 {
diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
index a239e939ea..add9fb8213 100644
--- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
@@ -296,7 +296,7 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
             communityGroups
         }
                 .execute { async ->
-                    val rootSpaces = session.spaceService().getRootSpaceSummaries()
+                    val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
                     val orders = rootSpaces.map {
                         it.roomId to session.getRoom(it.roomId)
                                 ?.getAccountDataEvent(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)

From fb736281f0c65085d61d6aaa66ce1132948e93b2 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 25 Apr 2022 17:49:50 +0200
Subject: [PATCH 04/15] Rename val

---
 .../java/im/vector/app/features/spaces/SpaceListViewModel.kt  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
index add9fb8213..376128d993 100644
--- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
@@ -292,8 +292,8 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
                         .accountDataService()
                         .getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))
                         .asFlow()
-        ) { _, communityGroups, _ ->
-            communityGroups
+        ) { _, spaces, _ ->
+            spaces
         }
                 .execute { async ->
                     val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }

From d2eca739f47ae4333b6ff063a8d94ab106555827 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 25 Apr 2022 17:55:31 +0200
Subject: [PATCH 05/15] Apply suggestion

---
 .../java/im/vector/app/features/spaces/SpaceListViewModel.kt  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
index 376128d993..709e8e62b5 100644
--- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
@@ -297,12 +297,12 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
         }
                 .execute { async ->
                     val rootSpaces = async.invoke().orEmpty().filter { it.flattenParentIds.isEmpty() }
-                    val orders = rootSpaces.map {
+                    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)),

From abdfd9deee876bb6d751d662795630dd88c5ea34 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 25 Apr 2022 18:29:49 +0200
Subject: [PATCH 06/15] Format

---
 .../java/im/vector/app/features/spaces/SpaceListViewModel.kt   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
index 709e8e62b5..25bf399c4b 100644
--- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
@@ -212,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()
                 )
             }

From c54261952533beccf8a6134eda305f3b05f2eec3 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Mon, 25 Apr 2022 18:31:30 +0200
Subject: [PATCH 07/15] We do not need to observe the user here

---
 .../app/features/spaces/SpaceListViewModel.kt     | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
index 25bf399c4b..4bf62644c2 100644
--- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListViewModel.kt
@@ -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
@@ -279,21 +278,13 @@ 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()
-        ) { _, spaces, _ ->
+        ) { spaces, _ ->
             spaces
         }
                 .execute { async ->

From 17189f2d580aeff32e50caa0d84fd9a74712aa2f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 25 Apr 2022 23:10:13 +0000
Subject: [PATCH 08/15] Bump dependency-check-gradle from 7.0.4.1 to 7.1.0.1

Bumps dependency-check-gradle from 7.0.4.1 to 7.1.0.1.

---
updated-dependencies:
- dependency-name: org.owasp:dependency-check-gradle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
---
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index 1ff1da7427..04fe13a846 100644
--- a/build.gradle
+++ b/build.gradle
@@ -21,7 +21,7 @@ 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.owasp:dependency-check-gradle:7.1.0.1'
         classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.20"
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files

From b2f9d6778a617d7c1cea3f6260a911aea11dde35 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Tue, 26 Apr 2022 11:29:40 +0200
Subject: [PATCH 09/15] Version hotfix 1.4.13

---
 matrix-sdk-android/build.gradle | 2 +-
 vector/build.gradle             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle
index 0cffa4148e..816b9716bd 100644
--- a/matrix-sdk-android/build.gradle
+++ b/matrix-sdk-android/build.gradle
@@ -32,7 +32,7 @@ android {
         // that the app's state is completely cleared between tests.
         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_UNIX_DATE", "\"${gitRevisionUnixDate()}\""
diff --git a/vector/build.gradle b/vector/build.gradle
index c7950da28e..0104f71f3b 100644
--- a/vector/build.gradle
+++ b/vector/build.gradle
@@ -18,7 +18,7 @@ ext.versionMinor = 4
 // 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
 // is the value for the next regular release.
-ext.versionPatch = 12
+ext.versionPatch = 13
 
 static def getGitTimestamp() {
     def cmd = 'git show -s --format=%ct'

From da656ac47001faf65047b619578de60031f894db Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Tue, 26 Apr 2022 11:30:53 +0200
Subject: [PATCH 10/15] Changelog

---
 changelog.d/5835.bugfix | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 changelog.d/5835.bugfix

diff --git a/changelog.d/5835.bugfix b/changelog.d/5835.bugfix
new file mode 100644
index 0000000000..9c450fb496
--- /dev/null
+++ b/changelog.d/5835.bugfix
@@ -0,0 +1 @@
+Fix UI freeze observed after each incremental sync

From ebcab189f26aa9ff70c7ca8825be926f4586f45b Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Tue, 26 Apr 2022 11:31:51 +0200
Subject: [PATCH 11/15] towncrier

---
 CHANGES.md              | 8 ++++++++
 changelog.d/5835.bugfix | 1 -
 2 files changed, 8 insertions(+), 1 deletion(-)
 delete mode 100644 changelog.d/5835.bugfix

diff --git a/CHANGES.md b/CHANGES.md
index 4728994d77..f952ec952a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -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)
 =======================================
 
diff --git a/changelog.d/5835.bugfix b/changelog.d/5835.bugfix
deleted file mode 100644
index 9c450fb496..0000000000
--- a/changelog.d/5835.bugfix
+++ /dev/null
@@ -1 +0,0 @@
-Fix UI freeze observed after each incremental sync

From 6b5822e3d5abe643a7e42798e47bfd829e5341a1 Mon Sep 17 00:00:00 2001
From: Benoit Marty <benoit@matrix.org>
Date: Tue, 26 Apr 2022 11:35:43 +0200
Subject: [PATCH 12/15] fastlane (same content than for 1.4.12)

---
 fastlane/metadata/android/en-US/changelogs/40104130.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 fastlane/metadata/android/en-US/changelogs/40104130.txt

diff --git a/fastlane/metadata/android/en-US/changelogs/40104130.txt b/fastlane/metadata/android/en-US/changelogs/40104130.txt
new file mode 100644
index 0000000000..ea188c101c
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/40104130.txt
@@ -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

From 66fd100333a86f20db72db0806620d25c02262f8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 26 Apr 2022 13:00:14 +0000
Subject: [PATCH 13/15] Bump dokka-gradle-plugin from 1.6.20 to 1.6.21

Bumps dokka-gradle-plugin from 1.6.20 to 1.6.21.

---
updated-dependencies:
- dependency-name: org.jetbrains.dokka:dokka-gradle-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
---
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index 04fe13a846..7a7f48d053 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,7 +22,7 @@ buildscript {
         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.1.0.1'
-        classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.20"
+        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
     }

From 766059ffd16b19128aa4121eace78e48409f18b6 Mon Sep 17 00:00:00 2001
From: Claire G <claire.1817@hotmail.fr>
Date: Tue, 26 Apr 2022 15:11:18 +0200
Subject: [PATCH 14/15] disable update-gradle-wrapper for forks

---
 .github/workflows/update-gradle-wrapper.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/update-gradle-wrapper.yml b/.github/workflows/update-gradle-wrapper.yml
index 1cbf29cc8d..f681f530d7 100644
--- a/.github/workflows/update-gradle-wrapper.yml
+++ b/.github/workflows/update-gradle-wrapper.yml
@@ -13,6 +13,8 @@ jobs:
 
       - name: Update Gradle Wrapper
         uses: gradle-update/update-gradle-wrapper-action@v1
+        # Tchap: Disabled for no
+        if: github.repository == 'vector-im/element-android'
         with:
           repo-token: ${{ secrets.GITHUB_TOKEN }}
           target-branch: develop

From 40f3165d7f068ae85a9c60cc7bb7ea408097009f Mon Sep 17 00:00:00 2001
From: Claire G <claire.1817@hotmail.fr>
Date: Tue, 26 Apr 2022 15:13:27 +0200
Subject: [PATCH 15/15] update comment

---
 .github/workflows/update-gradle-wrapper.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/update-gradle-wrapper.yml b/.github/workflows/update-gradle-wrapper.yml
index f681f530d7..63aaae15a5 100644
--- a/.github/workflows/update-gradle-wrapper.yml
+++ b/.github/workflows/update-gradle-wrapper.yml
@@ -13,7 +13,7 @@ jobs:
 
       - name: Update Gradle Wrapper
         uses: gradle-update/update-gradle-wrapper-action@v1
-        # Tchap: Disabled for no
+        # Skip in forks
         if: github.repository == 'vector-im/element-android'
         with:
           repo-token: ${{ secrets.GITHUB_TOKEN }}