From 59637c4a6bcfd3545a8e72a20c2bf8113aab6f86 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 14 Apr 2021 21:30:29 +0200 Subject: [PATCH 1/3] Revert to Realm 10.3.1 to fix issue with migration Waiting for https://github.com/realm/realm-java/issues/7402 --- CHANGES.md | 6 ++++++ matrix-sdk-android/build.gradle | 7 +++++-- vector/build.gradle | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 40228f7db8..7201c75850 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +Changes in Element 1.1.5 (2021-XX-XX) +=================================================== + +Bugfix 🐛: + - Fix crash during Realm migration + Changes in Element 1.1.4 (2021-04-09) =================================================== diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 34460c6ab5..1191e11b11 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -6,10 +6,13 @@ apply plugin: 'realm-android' buildscript { repositories { - mavenCentral() + // mavenCentral() + //noinspection GrDeprecatedAPIUsage + jcenter() } dependencies { - classpath "io.realm:realm-gradle-plugin:10.4.0" + // Stick to this version until https://github.com/realm/realm-java/issues/7402 is fixed + classpath "io.realm:realm-gradle-plugin:10.3.1" } } diff --git a/vector/build.gradle b/vector/build.gradle index d5a105d893..d561382e2d 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -14,7 +14,7 @@ kapt { // Note: 2 digits max for each value ext.versionMajor = 1 ext.versionMinor = 1 -ext.versionPatch = 4 +ext.versionPatch = 5 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' From e4375522ff558b9cc5010d4adcdd447ecd4322a1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 14 Apr 2021 22:35:30 +0200 Subject: [PATCH 2/3] Fix crash when playing video (#3179) --- CHANGES.md | 1 + .../app/core/glide/VectorGlideModelLoader.kt | 12 ++-- .../features/media/BaseAttachmentProvider.kt | 12 ++-- .../media/DataAttachmentRoomProvider.kt | 6 +- .../media/RoomEventsAttachmentProvider.kt | 6 +- .../features/media/VideoContentRenderer.kt | 62 ++++++++++--------- 6 files changed, 61 insertions(+), 38 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7201c75850..1652443c63 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ Changes in Element 1.1.5 (2021-XX-XX) Bugfix 🐛: - Fix crash during Realm migration + - Fix crash when playing video (#3179) Changes in Element 1.1.4 (2021-04-09) =================================================== diff --git a/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt b/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt index cbc5effe44..fb2f59d6b5 100644 --- a/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt +++ b/vector/src/main/java/im/vector/app/core/glide/VectorGlideModelLoader.kt @@ -28,8 +28,10 @@ import com.bumptech.glide.signature.ObjectKey import im.vector.app.core.extensions.vectorComponent import im.vector.app.core.files.LocalFilesHelper import im.vector.app.features.media.ImageContentRenderer +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import okhttp3.OkHttpClient import timber.log.Timber import java.io.IOException @@ -121,10 +123,12 @@ class VectorGlideDataFetcher(context: Context, url = data.url, elementToDecrypt = data.elementToDecrypt) } - result.fold( - { callback.onDataReady(it.inputStream()) }, - { callback.onLoadFailed(it as? Exception ?: IOException(it.localizedMessage)) } - ) + withContext(Dispatchers.Main) { + result.fold( + { callback.onDataReady(it.inputStream()) }, + { callback.onLoadFailed(it as? Exception ?: IOException(it.localizedMessage)) } + ) + } } // val url = contentUrlResolver.resolveFullSize(data.url) // ?: return diff --git a/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt b/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt index 103f42e903..d3ab39abef 100644 --- a/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt +++ b/vector/src/main/java/im/vector/app/features/media/BaseAttachmentProvider.kt @@ -31,8 +31,10 @@ import im.vector.lib.attachmentviewer.AttachmentInfo import im.vector.lib.attachmentviewer.AttachmentSourceProvider import im.vector.lib.attachmentviewer.ImageLoaderTarget import im.vector.lib.attachmentviewer.VideoLoaderTarget +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.matrix.android.sdk.api.session.events.model.isVideoMessage import org.matrix.android.sdk.api.session.file.FileService import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent @@ -162,10 +164,12 @@ abstract class BaseAttachmentProvider( elementToDecrypt = data.elementToDecrypt ) } - result.fold( - { target.onVideoFileReady(info.uid, it) }, - { target.onVideoFileLoadFailed(info.uid) } - ) + withContext(Dispatchers.Main) { + result.fold( + { target.onVideoFileReady(info.uid, it) }, + { target.onVideoFileLoadFailed(info.uid) } + ) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/media/DataAttachmentRoomProvider.kt b/vector/src/main/java/im/vector/app/features/media/DataAttachmentRoomProvider.kt index d326b8e50a..630433506f 100644 --- a/vector/src/main/java/im/vector/app/features/media/DataAttachmentRoomProvider.kt +++ b/vector/src/main/java/im/vector/app/features/media/DataAttachmentRoomProvider.kt @@ -19,8 +19,10 @@ package im.vector.app.features.media import im.vector.app.core.date.VectorDateFormatter import im.vector.app.core.resources.StringProvider import im.vector.lib.attachmentviewer.AttachmentInfo +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.matrix.android.sdk.api.session.file.FileService import org.matrix.android.sdk.api.session.room.Room import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent @@ -87,7 +89,9 @@ class DataAttachmentRoomProvider( elementToDecrypt = item.elementToDecrypt ) } - callback(result.getOrNull()) + withContext(Dispatchers.Main) { + callback(result.getOrNull()) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/media/RoomEventsAttachmentProvider.kt b/vector/src/main/java/im/vector/app/features/media/RoomEventsAttachmentProvider.kt index fd3386826a..976f13df58 100644 --- a/vector/src/main/java/im/vector/app/features/media/RoomEventsAttachmentProvider.kt +++ b/vector/src/main/java/im/vector/app/features/media/RoomEventsAttachmentProvider.kt @@ -19,8 +19,10 @@ package im.vector.app.features.media import im.vector.app.core.date.VectorDateFormatter import im.vector.app.core.resources.StringProvider import im.vector.lib.attachmentviewer.AttachmentInfo +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.file.FileService import org.matrix.android.sdk.api.session.room.model.message.MessageContent @@ -134,7 +136,9 @@ class RoomEventsAttachmentProvider( url = messageContent.getFileUrl(), elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt()) } - callback(result.getOrNull()) + withContext(Dispatchers.Main) { + callback(result.getOrNull()) + } } } } diff --git a/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt b/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt index 59b612afb1..80d2d8ba45 100644 --- a/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/media/VideoContentRenderer.kt @@ -25,8 +25,10 @@ import im.vector.app.R import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.error.ErrorFormatter import im.vector.app.core.files.LocalFilesHelper +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import kotlinx.parcelize.Parcelize import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt import timber.log.Timber @@ -83,21 +85,23 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc url = data.url, elementToDecrypt = data.elementToDecrypt) } - result.fold( - { data -> - thumbnailView.isVisible = false - loadingView.isVisible = false - videoView.isVisible = true + withContext(Dispatchers.Main) { + result.fold( + { data -> + thumbnailView.isVisible = false + loadingView.isVisible = false + videoView.isVisible = true - videoView.setVideoPath(data.path) - videoView.start() - }, - { - loadingView.isVisible = false - errorView.isVisible = true - errorView.text = errorFormatter.toHumanReadable(it) - } - ) + videoView.setVideoPath(data.path) + videoView.start() + }, + { + loadingView.isVisible = false + errorView.isVisible = true + errorView.text = errorFormatter.toHumanReadable(it) + } + ) + } } } } else { @@ -124,21 +128,23 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc url = data.url, elementToDecrypt = null) } - result.fold( - { data -> - thumbnailView.isVisible = false - loadingView.isVisible = false - videoView.isVisible = true + withContext(Dispatchers.Main) { + result.fold( + { data -> + thumbnailView.isVisible = false + loadingView.isVisible = false + videoView.isVisible = true - videoView.setVideoPath(data.path) - videoView.start() - }, - { - loadingView.isVisible = false - errorView.isVisible = true - errorView.text = errorFormatter.toHumanReadable(it) - } - ) + videoView.setVideoPath(data.path) + videoView.start() + }, + { + loadingView.isVisible = false + errorView.isVisible = true + errorView.text = errorFormatter.toHumanReadable(it) + } + ) + } } } } From ccf7dd9583a07e7d7bdb7489700009e50e957d0b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 14 Apr 2021 22:41:57 +0200 Subject: [PATCH 3/3] Add changelog file --- fastlane/metadata/android/en-US/changelogs/40101050.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/40101050.txt diff --git a/fastlane/metadata/android/en-US/changelogs/40101050.txt b/fastlane/metadata/android/en-US/changelogs/40101050.txt new file mode 100644 index 0000000000..917dbee284 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/40101050.txt @@ -0,0 +1,2 @@ +Main changes in this version: hot fixes for 1.1.4 +Full changelog: https://github.com/vector-im/element-android/releases/tag/v1.1.5 \ No newline at end of file