diff --git a/changelog.d/6166.feature b/changelog.d/6166.feature new file mode 100644 index 0000000000..024794bcb3 --- /dev/null +++ b/changelog.d/6166.feature @@ -0,0 +1 @@ +Add settings switch to allow autoplaying animated images diff --git a/vector/src/main/java/im/vector/app/core/resources/UserPreferencesProvider.kt b/vector/src/main/java/im/vector/app/core/resources/UserPreferencesProvider.kt index d39dcbe318..09bb78c926 100644 --- a/vector/src/main/java/im/vector/app/core/resources/UserPreferencesProvider.kt +++ b/vector/src/main/java/im/vector/app/core/resources/UserPreferencesProvider.kt @@ -56,4 +56,8 @@ class UserPreferencesProvider @Inject constructor(private val vectorPreferences: fun showLiveSenderInfo(): Boolean { return vectorPreferences.showLiveSenderInfo() } + + fun autoplayAnimatedImages(): Boolean { + return vectorPreferences.autoplayAnimatedImages() + } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt index 7874f843e1..7e4ec75783 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageInformationDataFactory.kt @@ -32,6 +32,7 @@ import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.crypto.verification.VerificationState import org.matrix.android.sdk.api.session.events.model.EventType import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent +import org.matrix.android.sdk.api.session.events.model.getMsgType import org.matrix.android.sdk.api.session.events.model.isAttachmentMessage import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.room.model.ReferencesAggregatedContent @@ -119,6 +120,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses isLastFromThisSender = isLastFromThisSender, e2eDecoration = e2eDecoration, sendStateDecoration = sendStateDecoration, + messageType = event.root.getMsgType() ) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt index 737b0dc85d..dad0e3e4ed 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/MessageItemAttributesFactory.kt @@ -67,7 +67,8 @@ class MessageItemAttributesFactory @Inject constructor( threadSummaryFormatted = displayableEventFormatter.formatThreadSummary(threadDetails?.threadSummaryLatestEvent).toString(), threadDetails = threadDetails, reactionsSummaryEvents = reactionsSummaryEvents, - areThreadMessagesEnabled = preferencesProvider.areThreadMessagesEnabled() + areThreadMessagesEnabled = preferencesProvider.areThreadMessagesEnabled(), + autoplayAnimatedImages = preferencesProvider.autoplayAnimatedImages() ) } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt index b9d79d5818..24a148885f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsMessageItem.kt @@ -188,6 +188,7 @@ abstract class AbsMessageItem : AbsBaseMessageItem val threadSummaryFormatted: String? = null, val threadDetails: ThreadDetails? = null, val areThreadMessagesEnabled: Boolean = false, + val autoplayAnimatedImages: Boolean = false, override val reactionsSummaryEvents: ReactionsSummaryEvents? = null, ) : AbsBaseMessageItem.Attributes { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt index 8485c40ef9..f3ab0e838b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt @@ -34,6 +34,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStat import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout import im.vector.app.features.home.room.detail.timeline.style.granularRoundedCorners import im.vector.app.features.media.ImageContentRenderer +import org.matrix.android.sdk.api.session.room.model.message.MessageType @EpoxyModelClass(layout = R.layout.item_timeline_event_base) abstract class MessageImageVideoItem : AbsMessageItem() { @@ -80,7 +81,17 @@ abstract class MessageImageVideoItem : AbsMessageItemClick on the read receipts for a detailed list. Show chat effects Use /confetti command or send a message containing ❄️ or 🎉 + Autoplay animated images + Play animated images in the timeline as soon as they are visible Show join and leave events Invites, removes, and bans are unaffected. Show account events diff --git a/vector/src/main/res/xml/vector_settings_preferences.xml b/vector/src/main/res/xml/vector_settings_preferences.xml index 7ff588ca76..1a3c62e0e8 100644 --- a/vector/src/main/res/xml/vector_settings_preferences.xml +++ b/vector/src/main/res/xml/vector_settings_preferences.xml @@ -140,6 +140,12 @@ android:summary="@string/settings_chat_effects_description" android:title="@string/settings_chat_effects_title" /> + +