From 1acd8e10499c6553996142591b17d44b9d375273 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 6 Dec 2022 15:01:47 +0100 Subject: [PATCH 1/5] Do not propagate failure if saving the filter server side fails. This will be retried later. --- .../session/filter/GetCurrentFilterTask.kt | 2 +- .../internal/session/filter/SaveFilterTask.kt | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/GetCurrentFilterTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/GetCurrentFilterTask.kt index e88f286e27..76805c5c51 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/GetCurrentFilterTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/GetCurrentFilterTask.kt @@ -42,7 +42,7 @@ internal class DefaultGetCurrentFilterTask @Inject constructor( return when (storedFilterBody) { currentFilterBody -> storedFilterId ?: storedFilterBody - else -> saveFilter(currentFilter) + else -> saveFilter(currentFilter) ?: currentFilterBody } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/SaveFilterTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/SaveFilterTask.kt index 82d5ff4d2f..0223cd3ee7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/SaveFilterTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/filter/SaveFilterTask.kt @@ -16,6 +16,7 @@ package org.matrix.android.sdk.internal.session.filter +import org.matrix.android.sdk.api.extensions.tryOrNull import org.matrix.android.sdk.internal.di.UserId import org.matrix.android.sdk.internal.network.GlobalErrorReceiver import org.matrix.android.sdk.internal.network.executeRequest @@ -24,8 +25,9 @@ import javax.inject.Inject /** * Save a filter, in db and if any changes, upload to the server. + * Return the filterId if uploading to the server is successful, else return null. */ -internal interface SaveFilterTask : Task { +internal interface SaveFilterTask : Task { data class Params( val filter: Filter @@ -39,18 +41,20 @@ internal class DefaultSaveFilterTask @Inject constructor( private val globalErrorReceiver: GlobalErrorReceiver, ) : SaveFilterTask { - override suspend fun execute(params: SaveFilterTask.Params): String { + override suspend fun execute(params: SaveFilterTask.Params): String? { val filter = params.filter - val filterResponse = executeRequest(globalErrorReceiver) { - // TODO auto retry - filterAPI.uploadFilter(userId, filter) + val filterResponse = tryOrNull { + executeRequest(globalErrorReceiver) { + filterAPI.uploadFilter(userId, filter) + } } + val filterId = filterResponse?.filterId filterRepository.storeSyncFilter( filter = filter, - filterId = filterResponse.filterId, + filterId = filterId.orEmpty(), roomEventFilter = FilterFactory.createDefaultRoomFilter() ) - return filterResponse.filterId + return filterId } } From 53b703dcafe14b7153840bc72d52d789f60233cb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Dec 2022 13:54:20 +0100 Subject: [PATCH 2/5] Changelog --- changelog.d/7725.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/7725.bugfix diff --git a/changelog.d/7725.bugfix b/changelog.d/7725.bugfix new file mode 100644 index 0000000000..b701451505 --- /dev/null +++ b/changelog.d/7725.bugfix @@ -0,0 +1 @@ +Fix crash when the network is not available. From 6c84668611d2dd63a365caa27b9144646a6e582b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Dec 2022 13:58:02 +0100 Subject: [PATCH 3/5] Hotfix 1.5.11 --- matrix-sdk-android/build.gradle | 2 +- vector-app/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 60b0329fbc..0b5dc1aacf 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -62,7 +62,7 @@ android { // that the app's state is completely cleared between tests. testInstrumentationRunnerArguments clearPackageData: 'true' - buildConfigField "String", "SDK_VERSION", "\"1.5.10\"" + buildConfigField "String", "SDK_VERSION", "\"1.5.11\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\"" diff --git a/vector-app/build.gradle b/vector-app/build.gradle index 86b94a8497..0796afe38b 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -37,7 +37,7 @@ ext.versionMinor = 5 // 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 = 10 +ext.versionPatch = 11 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' From a0bba91d67f8832812e766baf31b527a5acd6e42 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Dec 2022 13:58:51 +0100 Subject: [PATCH 4/5] Fastlane file for hotfix 1.5.11 --- fastlane/metadata/android/en-US/changelogs/40105110.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/40105110.txt diff --git a/fastlane/metadata/android/en-US/changelogs/40105110.txt b/fastlane/metadata/android/en-US/changelogs/40105110.txt new file mode 100644 index 0000000000..c9e5ba5fa9 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/40105110.txt @@ -0,0 +1,2 @@ +Main changes in this version: New implementation of the full screen mode for the Rich Text Editor and bugfixes. +Full changelog: https://github.com/vector-im/element-android/releases From 3132a7d463d7ce4443a2d1496c3452a85706e95c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Dec 2022 13:59:42 +0100 Subject: [PATCH 5/5] Towncrier 1.5.11 --- CHANGES.md | 8 ++++++++ changelog.d/7725.bugfix | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) delete mode 100644 changelog.d/7725.bugfix diff --git a/CHANGES.md b/CHANGES.md index 022591f5a1..c170c3b92b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,11 @@ +Changes in Element 1.5.11 (2022-12-07) +====================================== + +Bugfixes 🐛 +---------- + - Fix crash when the network is not available. ([#7725](https://github.com/vector-im/element-android/issues/7725)) + + Changes in Element v1.5.10 (2022-11-30) ======================================= diff --git a/changelog.d/7725.bugfix b/changelog.d/7725.bugfix deleted file mode 100644 index b701451505..0000000000 --- a/changelog.d/7725.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix crash when the network is not available.