From fa65cc59fe1d87805695330de93ffddd1cf52b9e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 14 Dec 2021 14:46:08 +0100 Subject: [PATCH 01/20] Version++ --- 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 477f971e04..d0dee31e9d 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -31,7 +31,7 @@ android { // that the app's state is completely cleared between tests. testInstrumentationRunnerArguments clearPackageData: 'true' - buildConfigField "String", "SDK_VERSION", "\"1.3.10\"" + buildConfigField "String", "SDK_VERSION", "\"1.3.11\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" resValue "string", "git_sdk_revision", "\"${gitRevision()}\"" diff --git a/vector/build.gradle b/vector/build.gradle index a578fdb52f..490057192e 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -15,7 +15,7 @@ kapt { // Note: 2 digits max for each value ext.versionMajor = 1 ext.versionMinor = 3 -ext.versionPatch = 10 +ext.versionPatch = 11 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' From 4949a063430a0eb623afa034c23b4886894ea13a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 14 Dec 2021 16:37:52 +0100 Subject: [PATCH 02/20] Use stable build tools for the release. --- tools/release/sign_apk.sh | 2 +- tools/release/sign_apk_unsafe.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/release/sign_apk.sh b/tools/release/sign_apk.sh index aae9e1a378..de5a22dd34 100755 --- a/tools/release/sign_apk.sh +++ b/tools/release/sign_apk.sh @@ -17,7 +17,7 @@ PARAM_KEYSTORE_PATH=$1 PARAM_APK=$2 # Other params -BUILD_TOOLS_VERSION="31.0.0-rc5" +BUILD_TOOLS_VERSION="31.0.0" MIN_SDK_VERSION=21 echo "Signing APK with build-tools version ${BUILD_TOOLS_VERSION} for min SDK version ${MIN_SDK_VERSION}..." diff --git a/tools/release/sign_apk_unsafe.sh b/tools/release/sign_apk_unsafe.sh index 5d209a4a2b..a7536616e9 100755 --- a/tools/release/sign_apk_unsafe.sh +++ b/tools/release/sign_apk_unsafe.sh @@ -23,7 +23,7 @@ PARAM_KS_PASS=$3 PARAM_KEY_PASS=$4 # Other params -BUILD_TOOLS_VERSION="31.0.0-rc5" +BUILD_TOOLS_VERSION="31.0.0" MIN_SDK_VERSION=21 echo "Signing APK with build-tools version ${BUILD_TOOLS_VERSION} for min SDK version ${MIN_SDK_VERSION}..." From 8b96d8cd8dfcc8c1ba1a8fc1a0977c31abe05301 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 15 Dec 2021 17:32:39 +0000 Subject: [PATCH 03/20] only acquire a wake lock if a lock is not already held --- .../java/im/vector/app/features/call/CallProximityManager.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt b/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt index 74e6c40783..3aeeac15af 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallProximityManager.kt @@ -93,7 +93,9 @@ class CallProximityManager @Inject constructor( if (wakeLock == null) { wakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, generateWakeLockTag()) } - wakeLock?.acquire(WAKE_LOCK_TIMEOUT_MILLIS) + wakeLock + ?.takeIf { !it.isHeld } + ?.acquire(WAKE_LOCK_TIMEOUT_MILLIS) } private fun onProximityFar() { From 8c913d29cb94eb5f12cb0ff564a4d7e55e131773 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 15 Dec 2021 17:35:27 +0000 Subject: [PATCH 04/20] adding changelog entry --- changelog.d/2467.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2467.bugfix diff --git a/changelog.d/2467.bugfix b/changelog.d/2467.bugfix new file mode 100644 index 0000000000..e707199e8a --- /dev/null +++ b/changelog.d/2467.bugfix @@ -0,0 +1 @@ +Fixing proximity sensor still being active after a call \ No newline at end of file From 4c238e81cf6cf08bdf99c98ffabe7f26ffab1472 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 15 Dec 2021 18:16:10 +0000 Subject: [PATCH 05/20] dismisses any potential loading dialogs when the linked fragment is destroyed - fixes leaking the activity window when the fragment is destroyed --- .../main/java/im/vector/app/core/platform/VectorBaseFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt index eab1101064..64443139f1 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseFragment.kt @@ -151,6 +151,7 @@ abstract class VectorBaseFragment : Fragment(), MavericksView override fun onDestroyView() { Timber.i("onDestroyView Fragment ${javaClass.simpleName}") _binding = null + dismissLoadingDialog() super.onDestroyView() } From eb9c46b9a265370102e636b204be9eff3115871e Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 15 Dec 2021 18:17:04 +0000 Subject: [PATCH 06/20] adding changelog entry --- changelog.d/4713.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4713.misc diff --git a/changelog.d/4713.misc b/changelog.d/4713.misc new file mode 100644 index 0000000000..5207c03871 --- /dev/null +++ b/changelog.d/4713.misc @@ -0,0 +1 @@ +Avoids leaking the activity windows when loading dialogs are displaying \ No newline at end of file From 818a8898b34186f5423dbde502e4c056f7d6dc90 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 15 Dec 2021 22:19:23 +0100 Subject: [PATCH 07/20] Call banner: center text vertically --- changelog.d/4710.bugfix | 1 + vector/src/main/res/layout/view_current_calls.xml | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 changelog.d/4710.bugfix diff --git a/changelog.d/4710.bugfix b/changelog.d/4710.bugfix new file mode 100644 index 0000000000..4abfaa91bd --- /dev/null +++ b/changelog.d/4710.bugfix @@ -0,0 +1 @@ +Call banner: center text vertically \ No newline at end of file diff --git a/vector/src/main/res/layout/view_current_calls.xml b/vector/src/main/res/layout/view_current_calls.xml index 892f097e01..ab4ed8a3b8 100644 --- a/vector/src/main/res/layout/view_current_calls.xml +++ b/vector/src/main/res/layout/view_current_calls.xml @@ -1,25 +1,20 @@ + android:textColor="?colorOnPrimary" + tools:text="@string/call_only_active" /> From db1e0af4e557087802d3f48b99b6af9199ce7e52 Mon Sep 17 00:00:00 2001 From: gradle-update-robot Date: Thu, 16 Dec 2021 00:13:21 +0000 Subject: [PATCH 08/20] Update Gradle Wrapper from 7.3.1 to 7.3.2. Signed-off-by: gradle-update-robot --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cf2b23094e..fa58fc5aae 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=b75392c5625a88bccd58a574552a5a323edca82dab5942d2d41097f809c6bcce -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip +distributionSha256Sum=dd54e87b4d7aa8ff3c6afb0f7805aa121d4b70bca55b8c9b1b896eb103184582 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 2275bdd4fa5a4a389ddd4a09b8a2dba943a2bc4f Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Thu, 16 Dec 2021 20:14:21 +0200 Subject: [PATCH 09/20] Fix crash ImmutableModelException --- .../home/room/detail/timeline/tools/EventRenderingTools.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt index 1e8a81ff61..4abaa4fae4 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt @@ -16,6 +16,7 @@ package im.vector.app.features.home.room.detail.timeline.tools +import android.text.SpannableStringBuilder import android.text.style.ClickableSpan import android.view.MotionEvent import android.widget.TextView @@ -44,7 +45,7 @@ fun CharSequence.findPillsAndProcess(scope: CoroutineScope, processBlock: (PillI fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence { val text = this.toString() - val spannable = toSpannable() + val spannable = SpannableStringBuilder(this) MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback { override fun onUrlClicked(url: String) { callback?.onUrlClicked(url, text) From ae6be3fdc4038e4efad0846a2f261f67403abf53 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 16 Dec 2021 18:34:00 +0000 Subject: [PATCH 10/20] adding missing binding options emote content - fixes android 12+ crash when certain emojis are used within the emote content --- .../home/room/detail/timeline/factory/MessageItemFactory.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt index 22d282d567..28b2d98909 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt @@ -613,7 +613,7 @@ class MessageItemFactory @Inject constructor( val formattedBody = SpannableStringBuilder() formattedBody.append("* ${informationData.memberName} ") formattedBody.append(messageContent.getHtmlBody()) - + val bindingOptions = spanUtils.getBindingOptions(formattedBody) val message = formattedBody.linkify(callback) return MessageTextItem_() @@ -625,6 +625,7 @@ class MessageItemFactory @Inject constructor( message(message) } } + .bindingOptions(bindingOptions) .leftGuideline(avatarSizeProvider.leftGuideline) .previewUrlRetriever(callback?.getPreviewUrlRetriever()) .imageContentRenderer(imageContentRenderer) From 049cad7d2c979911d43315ab95e54ae60cc98ade Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 16 Dec 2021 18:37:03 +0000 Subject: [PATCH 11/20] adding changelog entry --- changelog.d/4743.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4743.bugfix diff --git a/changelog.d/4743.bugfix b/changelog.d/4743.bugfix new file mode 100644 index 0000000000..1731a3583e --- /dev/null +++ b/changelog.d/4743.bugfix @@ -0,0 +1 @@ +Fixes crash when launching rooms which contain emojis in the notice content on android 12+ \ No newline at end of file From cabf12289bfa3cf99617bfa55fa8fbad41a44df2 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Thu, 16 Dec 2021 20:39:21 +0200 Subject: [PATCH 12/20] Add changelog --- changelog.d/4742.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4742.bugfix diff --git a/changelog.d/4742.bugfix b/changelog.d/4742.bugfix new file mode 100644 index 0000000000..ba4f32acf7 --- /dev/null +++ b/changelog.d/4742.bugfix @@ -0,0 +1 @@ +Fix app crash uppon long press on a reply event From ca58a04f57a75148ea4fcb28842629ef7aa2487d Mon Sep 17 00:00:00 2001 From: ClaireGizard Date: Thu, 16 Dec 2021 21:10:03 +0100 Subject: [PATCH 13/20] Small UI fix in room member profile hearder (#4700) Small ui fix on room member profile name Co-authored-by: Claire Gizard --- changelog.d/4700.bugfix | 1 + .../view_stub_room_member_profile_header.xml | 54 ++++++++++--------- 2 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 changelog.d/4700.bugfix diff --git a/changelog.d/4700.bugfix b/changelog.d/4700.bugfix new file mode 100644 index 0000000000..c8ad7c9b66 --- /dev/null +++ b/changelog.d/4700.bugfix @@ -0,0 +1 @@ +Fix name and shield are truncated in the room detail screen \ No newline at end of file diff --git a/vector/src/main/res/layout/view_stub_room_member_profile_header.xml b/vector/src/main/res/layout/view_stub_room_member_profile_header.xml index 6df1010196..40f4bd8515 100644 --- a/vector/src/main/res/layout/view_stub_room_member_profile_header.xml +++ b/vector/src/main/res/layout/view_stub_room_member_profile_header.xml @@ -12,8 +12,8 @@ android:id="@+id/memberProfileInfoContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" app:layout_constraintBottom_toTopOf="@id/memberProfileNameView" app:layout_constraintTop_toTopOf="@id/memberProfileNameView"> @@ -23,7 +23,7 @@ android:layout_height="128dp" android:layout_marginBottom="16dp" android:contentDescription="@string/avatar" - app:layout_constraintBottom_toTopOf="@id/memberProfileNameView" + app:layout_constraintBottom_toTopOf="@id/memberProfileLinearLayout" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -45,30 +45,36 @@ tools:src="@drawable/ic_presence_offline" tools:visibility="visible" /> - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/memberProfileAvatarView"> + + + + + + Date: Fri, 17 Dec 2021 09:22:12 +0000 Subject: [PATCH 14/20] Update changelog.d/4743.bugfix Co-authored-by: Benoit Marty --- changelog.d/4743.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/4743.bugfix b/changelog.d/4743.bugfix index 1731a3583e..645b812314 100644 --- a/changelog.d/4743.bugfix +++ b/changelog.d/4743.bugfix @@ -1 +1 @@ -Fixes crash when launching rooms which contain emojis in the notice content on android 12+ \ No newline at end of file +Fixes crash when launching rooms which contain emojis in the emote content on android 12+ \ No newline at end of file From 37db28ae7cc6c2430671bc1fb022af3d1c134fba Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 09:25:16 +0000 Subject: [PATCH 15/20] using the safe emoji processor to avoid the timeline failing when processing the content and the emoji library hasn't initialised yet --- .../main/java/im/vector/app/features/html/SpanUtils.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt index 27c966e33e..5e9e4263b5 100644 --- a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt +++ b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt @@ -21,13 +21,15 @@ import android.text.Spanned import android.text.style.MetricAffectingSpan import android.text.style.StrikethroughSpan import android.text.style.UnderlineSpan -import androidx.emoji2.text.EmojiCompat +import im.vector.app.EmojiCompatWrapper import im.vector.app.features.home.room.detail.timeline.item.BindingOptions import javax.inject.Inject -class SpanUtils @Inject constructor() { +class SpanUtils @Inject constructor( + private val emojiCompat: EmojiCompatWrapper +) { fun getBindingOptions(charSequence: CharSequence): BindingOptions { - val emojiCharSequence = EmojiCompat.get().process(charSequence) + val emojiCharSequence = emojiCompat.safeEmojiSpanify(charSequence) if (emojiCharSequence !is Spanned) { return BindingOptions() From e1eafd2c64a94386301b7102a5eb88cd29e079e4 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 09:26:10 +0000 Subject: [PATCH 16/20] adding changelog entry --- changelog.d/4733.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4733.bugfix diff --git a/changelog.d/4733.bugfix b/changelog.d/4733.bugfix new file mode 100644 index 0000000000..53979d21c4 --- /dev/null +++ b/changelog.d/4733.bugfix @@ -0,0 +1 @@ +Fixes unable to render messages by allowing them to render whilst the emoji library is initialising \ No newline at end of file From b73bae452a0be27b29848dd087a53f1591c55d97 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 09:37:50 +0000 Subject: [PATCH 17/20] adding comment to explain SpannableStringBuilder usage --- .../home/room/detail/timeline/tools/EventRenderingTools.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt index 4abaa4fae4..530e8d6a93 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt @@ -44,7 +44,8 @@ fun CharSequence.findPillsAndProcess(scope: CoroutineScope, processBlock: (PillI } fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence { - val text = this.toString() + val text = this.toString() + // SpannableStringBuilder is used to avoid Epoxy throwing ImmutableModelException val spannable = SpannableStringBuilder(this) MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback { override fun onUrlClicked(url: String) { From 6918372a876d6ac22a308c247b6c7a6bde448b52 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 10:37:51 +0000 Subject: [PATCH 18/20] extracting the emoji processing to an interface so that we can override the behaviour in the unit test --- .../vector/app/features/html/SpanUtilsTest.kt | 22 ++++++++++++++++++- .../java/im/vector/app/EmojiCompatWrapper.kt | 8 +++++-- .../im/vector/app/core/di/SingletonModule.kt | 5 +++++ .../format/DisplayableEventFormatter.kt | 6 ++--- .../reactions/ViewReactionsEpoxyController.kt | 8 +++---- .../im/vector/app/features/html/SpanUtils.kt | 6 ++--- .../reactions/widget/ReactionButton.kt | 8 +++---- 7 files changed, 46 insertions(+), 17 deletions(-) diff --git a/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt b/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt index d33fd4948a..a42a6f0212 100644 --- a/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt +++ b/vector/src/androidTest/java/im/vector/app/features/html/SpanUtilsTest.kt @@ -24,6 +24,7 @@ import android.text.Spanned import android.text.style.ForegroundColorSpan import android.text.style.StrikethroughSpan import android.text.style.UnderlineSpan +import androidx.emoji2.text.EmojiCompat import im.vector.app.InstrumentedTest import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeTrue @@ -32,12 +33,18 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import org.junit.runners.MethodSorters +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit @RunWith(JUnit4::class) @FixMethodOrder(MethodSorters.JVM) class SpanUtilsTest : InstrumentedTest { - private val spanUtils = SpanUtils() + private val spanUtils = SpanUtils { + val emojiCompat = EmojiCompat.get() + emojiCompat.waitForInit() + emojiCompat.process(it) ?: it + } private fun SpanUtils.canUseTextFuture(message: CharSequence): Boolean { return getBindingOptions(message).canUseTextFuture @@ -122,4 +129,17 @@ class SpanUtilsTest : InstrumentedTest { } private fun trueIfAlwaysAllowed() = Build.VERSION.SDK_INT < Build.VERSION_CODES.P + + private fun EmojiCompat.waitForInit() { + val latch = CountDownLatch(1) + registerInitCallback(object : EmojiCompat.InitCallback() { + override fun onInitialized() = latch.countDown() + override fun onFailed(throwable: Throwable?) { + latch.countDown() + throw RuntimeException(throwable) + } + }) + EmojiCompat.init(context()) + latch.await(30, TimeUnit.SECONDS) + } } diff --git a/vector/src/main/java/im/vector/app/EmojiCompatWrapper.kt b/vector/src/main/java/im/vector/app/EmojiCompatWrapper.kt index 995e2e8049..47133a61b4 100644 --- a/vector/src/main/java/im/vector/app/EmojiCompatWrapper.kt +++ b/vector/src/main/java/im/vector/app/EmojiCompatWrapper.kt @@ -23,8 +23,12 @@ import timber.log.Timber import javax.inject.Inject import javax.inject.Singleton +fun interface EmojiSpanify { + fun spanify(sequence: CharSequence): CharSequence +} + @Singleton -class EmojiCompatWrapper @Inject constructor(private val context: Context) { +class EmojiCompatWrapper @Inject constructor(private val context: Context) : EmojiSpanify { private var initialized = false @@ -49,7 +53,7 @@ class EmojiCompatWrapper @Inject constructor(private val context: Context) { }) } - fun safeEmojiSpanify(sequence: CharSequence): CharSequence { + override fun spanify(sequence: CharSequence): CharSequence { if (initialized) { try { return EmojiCompat.get().process(sequence) ?: sequence diff --git a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt index 14ed17d0bb..d83bb5cb57 100644 --- a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt @@ -26,6 +26,8 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent +import im.vector.app.EmojiCompatWrapper +import im.vector.app.EmojiSpanify import im.vector.app.core.dispatchers.CoroutineDispatchers import im.vector.app.core.error.DefaultErrorFormatter import im.vector.app.core.error.ErrorFormatter @@ -76,6 +78,9 @@ abstract class VectorBindModule { @Binds abstract fun bindDefaultClock(clock: DefaultClock): Clock + + @Binds + abstract fun bindEmojiSpanify(emojiCompatWrapper: EmojiCompatWrapper): EmojiSpanify } @InstallIn(SingletonComponent::class) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt index 3616367e7d..3892bfff85 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/format/DisplayableEventFormatter.kt @@ -17,7 +17,7 @@ package im.vector.app.features.home.room.detail.timeline.format import dagger.Lazy -import im.vector.app.EmojiCompatWrapper +import im.vector.app.EmojiSpanify import im.vector.app.R import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider @@ -39,7 +39,7 @@ import javax.inject.Inject class DisplayableEventFormatter @Inject constructor( private val stringProvider: StringProvider, private val colorProvider: ColorProvider, - private val emojiCompatWrapper: EmojiCompatWrapper, + private val emojiSpanify: EmojiSpanify, private val noticeEventFormatter: NoticeEventFormatter, private val htmlRenderer: Lazy ) { @@ -100,7 +100,7 @@ class DisplayableEventFormatter @Inject constructor( } EventType.REACTION -> { timelineEvent.root.getClearContent().toModel()?.relatesTo?.let { - val emojiSpanned = emojiCompatWrapper.safeEmojiSpanify(stringProvider.getString(R.string.sent_a_reaction, it.key)) + val emojiSpanned = emojiSpanify.spanify(stringProvider.getString(R.string.sent_a_reaction, it.key)) simpleFormat(senderName, emojiSpanned, appendAuthor) } ?: span { } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt index 0b3d381619..0031cf9feb 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsEpoxyController.kt @@ -20,7 +20,7 @@ import com.airbnb.epoxy.TypedEpoxyController import com.airbnb.mvrx.Fail import com.airbnb.mvrx.Incomplete import com.airbnb.mvrx.Success -import im.vector.app.EmojiCompatWrapper +import im.vector.app.EmojiSpanify import im.vector.app.R import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericFooterItem @@ -32,8 +32,8 @@ import javax.inject.Inject */ class ViewReactionsEpoxyController @Inject constructor( private val stringProvider: StringProvider, - private val emojiCompatWrapper: EmojiCompatWrapper) : - TypedEpoxyController() { + private val emojiSpanify: EmojiSpanify) : + TypedEpoxyController() { var listener: Listener? = null @@ -56,7 +56,7 @@ class ViewReactionsEpoxyController @Inject constructor( reactionInfoSimpleItem { id(reactionInfo.eventId) timeStamp(reactionInfo.timestamp) - reactionKey(host.emojiCompatWrapper.safeEmojiSpanify(reactionInfo.reactionKey)) + reactionKey(host.emojiSpanify.spanify(reactionInfo.reactionKey)) authorDisplayName(reactionInfo.authorName ?: reactionInfo.authorId) userClicked { host.listener?.didSelectUser(reactionInfo.authorId) } } diff --git a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt index 5e9e4263b5..e668f29a6a 100644 --- a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt +++ b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt @@ -21,15 +21,15 @@ import android.text.Spanned import android.text.style.MetricAffectingSpan import android.text.style.StrikethroughSpan import android.text.style.UnderlineSpan -import im.vector.app.EmojiCompatWrapper +import im.vector.app.EmojiSpanify import im.vector.app.features.home.room.detail.timeline.item.BindingOptions import javax.inject.Inject class SpanUtils @Inject constructor( - private val emojiCompat: EmojiCompatWrapper + private val emojiSpanify: EmojiSpanify ) { fun getBindingOptions(charSequence: CharSequence): BindingOptions { - val emojiCharSequence = emojiCompat.safeEmojiSpanify(charSequence) + val emojiCharSequence = emojiSpanify.spanify(charSequence) if (emojiCharSequence !is Spanned) { return BindingOptions() diff --git a/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt b/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt index 2b4e9ee5ab..67095b974a 100644 --- a/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt +++ b/vector/src/main/java/im/vector/app/features/reactions/widget/ReactionButton.kt @@ -24,7 +24,7 @@ import android.widget.LinearLayout import androidx.core.content.ContextCompat import androidx.core.content.withStyledAttributes import dagger.hilt.android.AndroidEntryPoint -import im.vector.app.EmojiCompatWrapper +import im.vector.app.EmojiSpanify import im.vector.app.R import im.vector.app.core.utils.DimensionConverter import im.vector.app.core.utils.TextUtils @@ -39,9 +39,9 @@ import javax.inject.Inject class ReactionButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : - LinearLayout(context, attrs, defStyleAttr), View.OnClickListener, View.OnLongClickListener { + LinearLayout(context, attrs, defStyleAttr), View.OnClickListener, View.OnLongClickListener { - @Inject lateinit var emojiCompatWrapper: EmojiCompatWrapper + @Inject lateinit var emojiSpanify: EmojiSpanify private val views: ReactionButtonBinding @@ -57,7 +57,7 @@ class ReactionButton @JvmOverloads constructor(context: Context, set(value) { field = value // maybe cache this for performances? - val emojiSpanned = emojiCompatWrapper.safeEmojiSpanify(value) + val emojiSpanned = emojiSpanify.spanify(value) views.reactionText.text = emojiSpanned } From ddbf8582dd323efeb9e7edb769268fcdee0b1744 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 10:46:03 +0000 Subject: [PATCH 19/20] removing trailing space --- .../home/room/detail/timeline/tools/EventRenderingTools.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt index 530e8d6a93..3226b56c24 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/tools/EventRenderingTools.kt @@ -44,7 +44,7 @@ fun CharSequence.findPillsAndProcess(scope: CoroutineScope, processBlock: (PillI } fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence { - val text = this.toString() + val text = this.toString() // SpannableStringBuilder is used to avoid Epoxy throwing ImmutableModelException val spannable = SpannableStringBuilder(this) MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback { From 6c127e9de50f58147cd2822fff93fd8b39ef5642 Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 17 Dec 2021 18:21:56 +0100 Subject: [PATCH 20/20] Release: prepare CHANGES --- CHANGES.md | 17 +++++++++++++++++ changelog.d/2467.bugfix | 1 - changelog.d/4700.bugfix | 1 - changelog.d/4710.bugfix | 1 - changelog.d/4713.misc | 1 - changelog.d/4733.bugfix | 1 - changelog.d/4742.bugfix | 1 - changelog.d/4743.bugfix | 1 - .../android/en-US/changelogs/40103110.txt | 2 ++ 9 files changed, 19 insertions(+), 7 deletions(-) delete mode 100644 changelog.d/2467.bugfix delete mode 100644 changelog.d/4700.bugfix delete mode 100644 changelog.d/4710.bugfix delete mode 100644 changelog.d/4713.misc delete mode 100644 changelog.d/4733.bugfix delete mode 100644 changelog.d/4742.bugfix delete mode 100644 changelog.d/4743.bugfix create mode 100644 fastlane/metadata/android/en-US/changelogs/40103110.txt diff --git a/CHANGES.md b/CHANGES.md index fbefb75e06..a776f483e6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,20 @@ +Changes in Element v1.3.11 (2021-12-17) +======================================= + +Bugfixes 🐛 +---------- + - Fixing proximity sensor still being active after a call ([#2467](https://github.com/vector-im/element-android/issues/2467)) + - Fix name and shield are truncated in the room detail screen ([#4700](https://github.com/vector-im/element-android/issues/4700)) + - Call banner: center text vertically ([#4710](https://github.com/vector-im/element-android/issues/4710)) + - Fixes unable to render messages by allowing them to render whilst the emoji library is initialising ([#4733](https://github.com/vector-im/element-android/issues/4733)) + - Fix app crash uppon long press on a reply event ([#4742](https://github.com/vector-im/element-android/issues/4742)) + - Fixes crash when launching rooms which contain emojis in the emote content on android 12+ ([#4743](https://github.com/vector-im/element-android/issues/4743)) + +Other changes +------------- + - Avoids leaking the activity windows when loading dialogs are displaying ([#4713](https://github.com/vector-im/element-android/issues/4713)) + + Changes in Element v1.3.10 (2021-12-14) ======================================= diff --git a/changelog.d/2467.bugfix b/changelog.d/2467.bugfix deleted file mode 100644 index e707199e8a..0000000000 --- a/changelog.d/2467.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixing proximity sensor still being active after a call \ No newline at end of file diff --git a/changelog.d/4700.bugfix b/changelog.d/4700.bugfix deleted file mode 100644 index c8ad7c9b66..0000000000 --- a/changelog.d/4700.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix name and shield are truncated in the room detail screen \ No newline at end of file diff --git a/changelog.d/4710.bugfix b/changelog.d/4710.bugfix deleted file mode 100644 index 4abfaa91bd..0000000000 --- a/changelog.d/4710.bugfix +++ /dev/null @@ -1 +0,0 @@ -Call banner: center text vertically \ No newline at end of file diff --git a/changelog.d/4713.misc b/changelog.d/4713.misc deleted file mode 100644 index 5207c03871..0000000000 --- a/changelog.d/4713.misc +++ /dev/null @@ -1 +0,0 @@ -Avoids leaking the activity windows when loading dialogs are displaying \ No newline at end of file diff --git a/changelog.d/4733.bugfix b/changelog.d/4733.bugfix deleted file mode 100644 index 53979d21c4..0000000000 --- a/changelog.d/4733.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixes unable to render messages by allowing them to render whilst the emoji library is initialising \ No newline at end of file diff --git a/changelog.d/4742.bugfix b/changelog.d/4742.bugfix deleted file mode 100644 index ba4f32acf7..0000000000 --- a/changelog.d/4742.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix app crash uppon long press on a reply event diff --git a/changelog.d/4743.bugfix b/changelog.d/4743.bugfix deleted file mode 100644 index 645b812314..0000000000 --- a/changelog.d/4743.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixes crash when launching rooms which contain emojis in the emote content on android 12+ \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/40103110.txt b/fastlane/metadata/android/en-US/changelogs/40103110.txt new file mode 100644 index 0000000000..c28b303a35 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/40103110.txt @@ -0,0 +1,2 @@ +Main changes in this version: Bug fixes! +Full changelog: https://github.com/vector-im/element-android/releases/tag/v1.3.11 \ No newline at end of file