diff --git a/CHANGES.md b/CHANGES.md index 318290107a..c411593627 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,49 @@ +Changes in Element v1.4.4 (2022-03-09) +====================================== + +Features ✨ +---------- + - Adds animated typing indicator to the bottom of the timeline ([#3296](https://github.com/vector-im/element-android/issues/3296)) + - Removes the topic and typing information from the room's top bar ([#4642](https://github.com/vector-im/element-android/issues/4642)) + - Add possibility to save media from Gallery + reorder choices in message context menu ([#5005](https://github.com/vector-im/element-android/issues/5005)) + - Improves settings error dialog messaging when changing avatar or display name fails ([#5418](https://github.com/vector-im/element-android/issues/5418)) + +Bugfixes 🐛 +---------- + - Open direct message screen when clicking on DM button in the space members list ([#4319](https://github.com/vector-im/element-android/issues/4319)) + - Fix incorrect media cache size in settings ([#5394](https://github.com/vector-im/element-android/issues/5394)) + - Setting an avatar when creating a room had no effect ([#5402](https://github.com/vector-im/element-android/issues/5402)) + - Fix reactions summary crash when reopening a room ([#5463](https://github.com/vector-im/element-android/issues/5463)) + - Fixing room titles overlapping the room image in the room toolbar ([#5468](https://github.com/vector-im/element-android/issues/5468)) + +In development 🚧 +---------------- + - Starts the FTUE account personalisation flow by adding an account created screen behind a feature flag ([#5158](https://github.com/vector-im/element-android/issues/5158)) + +SDK API changes ⚠️ +------------------ + - Change name of getTimeLineEvent and getTimeLineEventLive methods to getTimelineEvent and getTimelineEventLive. ([#5330](https://github.com/vector-im/element-android/issues/5330)) + +Other changes +------------- + - Improve Bubble layouts rendering ([#5303](https://github.com/vector-im/element-android/issues/5303)) + - Continue improving realm usage (potentially helping with storage and RAM usage) ([#5330](https://github.com/vector-im/element-android/issues/5330)) + - Update reaction button layout. ([#5313](https://github.com/vector-im/element-android/issues/5313)) + - Adds forceLoginFallback feature flag and usages to FTUE login and registration ([#5325](https://github.com/vector-im/element-android/issues/5325)) + - Override task affinity to prevent unknown activities running in our app tasks. ([#4498](https://github.com/vector-im/element-android/issues/4498)) + - Tentatively fixing the UI sanity test being unable to click on the space menu items ([#5269](https://github.com/vector-im/element-android/issues/5269)) + - Moves attachment-viewer, diff-match-patch, and multipicker modules to subfolders under library ([#5309](https://github.com/vector-im/element-android/issues/5309)) + - Log the `since` token used and `next_batch` token returned when doing an incremental sync. ([#5312](https://github.com/vector-im/element-android/issues/5312), [#5318](https://github.com/vector-im/element-android/issues/5318)) + - Upgrades material dependency version from 1.4.0 to 1.5.0 ([#5392](https://github.com/vector-im/element-android/issues/5392)) + - Using app name instead of hardcoded "Element" for exported keys filename ([#5326](https://github.com/vector-im/element-android/issues/5326)) + - Upgrade the plugin which generate strings with template from 1.2.2 to 2.0.0 ([#5348](https://github.com/vector-im/element-android/issues/5348)) + - Remove about 700 unused strings and their translations ([#5352](https://github.com/vector-im/element-android/issues/5352)) + - Creates dedicated VectorOverrides for forcing behaviour for local testing/development ([#5361](https://github.com/vector-im/element-android/issues/5361)) + - Cleanup unused threads build configurations ([#5379](https://github.com/vector-im/element-android/issues/5379)) + - Notify element-android channel each time a nightly build completes. ([#5314](https://github.com/vector-im/element-android/issues/5314)) + - Iterate on badge / unread indicator color ([#5456](https://github.com/vector-im/element-android/issues/5456)) + + Changes in Element v1.4.2 (2022-02-22 Palindrome Day!) ====================================================== diff --git a/changelog.d/3296.bugfix b/changelog.d/3296.bugfix deleted file mode 100644 index e5f8799f21..0000000000 --- a/changelog.d/3296.bugfix +++ /dev/null @@ -1 +0,0 @@ -Typing notifications moved from the header to the bottom of the timeline. \ No newline at end of file diff --git a/changelog.d/4319.bugfix b/changelog.d/4319.bugfix deleted file mode 100644 index da42c864c6..0000000000 --- a/changelog.d/4319.bugfix +++ /dev/null @@ -1 +0,0 @@ -Open direct message screen when clicking on DM button in the space members list diff --git a/changelog.d/4498.misc b/changelog.d/4498.misc deleted file mode 100644 index 78493b5d77..0000000000 --- a/changelog.d/4498.misc +++ /dev/null @@ -1 +0,0 @@ -Override task affinity to prevent unknown activities running in our app tasks. \ No newline at end of file diff --git a/changelog.d/4642.bugfix b/changelog.d/4642.bugfix deleted file mode 100644 index 2a5ea97196..0000000000 --- a/changelog.d/4642.bugfix +++ /dev/null @@ -1 +0,0 @@ -Update the top bar in a room: remove topic and typing information \ No newline at end of file diff --git a/changelog.d/5005.feature b/changelog.d/5005.feature deleted file mode 100644 index ce3b2ad1f9..0000000000 --- a/changelog.d/5005.feature +++ /dev/null @@ -1 +0,0 @@ -Add possibility to save media from Gallery + reorder choices in message context menu diff --git a/changelog.d/5158.wip b/changelog.d/5158.wip deleted file mode 100644 index 67a3d83a7a..0000000000 --- a/changelog.d/5158.wip +++ /dev/null @@ -1 +0,0 @@ -Starts the FTUE account personalisation flow by adding an account created screen behind a feature flag \ No newline at end of file diff --git a/changelog.d/5269.misc b/changelog.d/5269.misc deleted file mode 100644 index 699ddfd3dd..0000000000 --- a/changelog.d/5269.misc +++ /dev/null @@ -1 +0,0 @@ -Tentatively fixing the UI sanity test being unable to click on the space menu items \ No newline at end of file diff --git a/changelog.d/5303.misc b/changelog.d/5303.misc deleted file mode 100644 index dbad0b738d..0000000000 --- a/changelog.d/5303.misc +++ /dev/null @@ -1 +0,0 @@ -Improve Bubble layouts rendering. \ No newline at end of file diff --git a/changelog.d/5309.misc b/changelog.d/5309.misc deleted file mode 100644 index 83771995af..0000000000 --- a/changelog.d/5309.misc +++ /dev/null @@ -1 +0,0 @@ -Moves attachment-viewer, diff-match-patch, and multipicker modules to subfolders under library \ No newline at end of file diff --git a/changelog.d/5312.misc b/changelog.d/5312.misc deleted file mode 100644 index d724f1ba3f..0000000000 --- a/changelog.d/5312.misc +++ /dev/null @@ -1 +0,0 @@ -Log the `since` token used and `next_batch` token returned when doing an incremental sync. diff --git a/changelog.d/5313.misc b/changelog.d/5313.misc deleted file mode 100644 index efc225a0a4..0000000000 --- a/changelog.d/5313.misc +++ /dev/null @@ -1 +0,0 @@ -Update reaction button layout. \ No newline at end of file diff --git a/changelog.d/5314.misc b/changelog.d/5314.misc deleted file mode 100644 index 35fed08a61..0000000000 --- a/changelog.d/5314.misc +++ /dev/null @@ -1 +0,0 @@ -Notify element-android channel each time a nightly build completes. diff --git a/changelog.d/5318.misc b/changelog.d/5318.misc deleted file mode 100644 index d724f1ba3f..0000000000 --- a/changelog.d/5318.misc +++ /dev/null @@ -1 +0,0 @@ -Log the `since` token used and `next_batch` token returned when doing an incremental sync. diff --git a/changelog.d/5325.feature b/changelog.d/5325.feature deleted file mode 100644 index 23754c790d..0000000000 --- a/changelog.d/5325.feature +++ /dev/null @@ -1 +0,0 @@ -Adds forceLoginFallback feature flag and usages to FTUE login and registration \ No newline at end of file diff --git a/changelog.d/5326.misc b/changelog.d/5326.misc deleted file mode 100644 index 5ffa732d53..0000000000 --- a/changelog.d/5326.misc +++ /dev/null @@ -1 +0,0 @@ -[Export e2ee keys] use appName instead of element \ No newline at end of file diff --git a/changelog.d/5330.misc b/changelog.d/5330.misc deleted file mode 100644 index 6315ad536c..0000000000 --- a/changelog.d/5330.misc +++ /dev/null @@ -1 +0,0 @@ -Continue improving realm usage. \ No newline at end of file diff --git a/changelog.d/5330.sdk b/changelog.d/5330.sdk deleted file mode 100644 index 3f6d46401c..0000000000 --- a/changelog.d/5330.sdk +++ /dev/null @@ -1 +0,0 @@ -Change name of getTimeLineEvent and getTimeLineEventLive methods to getTimelineEvent and getTimelineEventLive. \ No newline at end of file diff --git a/changelog.d/5348.misc b/changelog.d/5348.misc deleted file mode 100644 index f5ee8627ce..0000000000 --- a/changelog.d/5348.misc +++ /dev/null @@ -1 +0,0 @@ -Upgrade the plugin which generate strings with template from 1.2.2 to 2.0.0 \ No newline at end of file diff --git a/changelog.d/5352.misc b/changelog.d/5352.misc deleted file mode 100644 index 956de682d8..0000000000 --- a/changelog.d/5352.misc +++ /dev/null @@ -1 +0,0 @@ -Remove about 700 unused strings and their translations \ No newline at end of file diff --git a/changelog.d/5361.misc b/changelog.d/5361.misc deleted file mode 100644 index d49554c7e7..0000000000 --- a/changelog.d/5361.misc +++ /dev/null @@ -1 +0,0 @@ -Creates dedicated VectorOverrides for forcing behaviour for local testing/development \ No newline at end of file diff --git a/changelog.d/5379.misc b/changelog.d/5379.misc deleted file mode 100644 index d485636f10..0000000000 --- a/changelog.d/5379.misc +++ /dev/null @@ -1 +0,0 @@ -Cleanup unused threads build configurations \ No newline at end of file diff --git a/changelog.d/5392.misc b/changelog.d/5392.misc deleted file mode 100644 index 54d7dba992..0000000000 --- a/changelog.d/5392.misc +++ /dev/null @@ -1 +0,0 @@ -Upgrades material dependency version from 1.4.0 to 1.5.0 diff --git a/changelog.d/5394.bugfix b/changelog.d/5394.bugfix deleted file mode 100644 index f8c5311492..0000000000 --- a/changelog.d/5394.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix incorrect media cache size in settings \ No newline at end of file diff --git a/changelog.d/5402.bugfix b/changelog.d/5402.bugfix deleted file mode 100644 index fde9e7e74f..0000000000 --- a/changelog.d/5402.bugfix +++ /dev/null @@ -1 +0,0 @@ -[Create room] Setting an avatar when creating a room had no effect \ No newline at end of file diff --git a/changelog.d/5418.feature b/changelog.d/5418.feature deleted file mode 100644 index 5e1efc8718..0000000000 --- a/changelog.d/5418.feature +++ /dev/null @@ -1 +0,0 @@ -Improves settings error dialog messaging when changing avatar or display name fails \ No newline at end of file diff --git a/changelog.d/5456.misc b/changelog.d/5456.misc deleted file mode 100644 index 94746ca788..0000000000 --- a/changelog.d/5456.misc +++ /dev/null @@ -1 +0,0 @@ -Iterate on badge / unread indicator color \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/40104040.txt b/fastlane/metadata/android/en-US/changelogs/40104040.txt new file mode 100644 index 0000000000..d36b10c390 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/40104040.txt @@ -0,0 +1,2 @@ +Main changes in this version: typing indicator UI updates. Various bug fixes and stability improvements. +Full changelog: https://github.com/vector-im/element-android/releases/tag/v1.4.4 \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt index 43fa9e0c2e..fb47fb5136 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/TimelineEventController.kt @@ -53,6 +53,7 @@ import im.vector.app.features.home.room.detail.timeline.item.DaySeparatorItem import im.vector.app.features.home.room.detail.timeline.item.DaySeparatorItem_ import im.vector.app.features.home.room.detail.timeline.item.ItemWithEvents import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData +import im.vector.app.features.home.room.detail.timeline.item.ReactionsSummaryEvents import im.vector.app.features.home.room.detail.timeline.item.ReadReceiptData import im.vector.app.features.home.room.detail.timeline.item.ReadReceiptsItem import im.vector.app.features.home.room.detail.timeline.url.PreviewUrlRetriever @@ -415,7 +416,12 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec partialState = partialState, lastSentEventIdWithoutReadReceipts = lastSentEventWithoutReadReceipts, callback = callback, - eventsGroup = timelineEventsGroup + eventsGroup = timelineEventsGroup, + reactionsSummaryEvents = ReactionsSummaryEvents( + onAddMoreClicked = { reactionListFactory.onAddMoreClicked(callback, event) }, + onShowLessClicked = { reactionListFactory.onShowLessClicked(event.eventId) }, + onShowMoreClicked = { reactionListFactory.onShowMoreClicked(event.eventId) } + ) ) modelCache[position] = buildCacheItem(params) numberOfEventsToBuild++ diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt index 0161f0b55d..a5d6f75387 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/CallItemFactory.kt @@ -26,6 +26,7 @@ import im.vector.app.features.home.room.detail.timeline.helper.MessageItemAttrib import im.vector.app.features.home.room.detail.timeline.item.CallTileTimelineItem import im.vector.app.features.home.room.detail.timeline.item.CallTileTimelineItem_ import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData +import im.vector.app.features.home.room.detail.timeline.item.ReactionsSummaryEvents 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.room.model.RoomSummary @@ -61,7 +62,8 @@ class CallItemFactory @Inject constructor( highlight = params.isHighlighted, informationData = informationData, isStillActive = callEventGrouper.isInCall(), - formattedDuration = callEventGrouper.formattedDuration() + formattedDuration = callEventGrouper.formattedDuration(), + reactionsSummaryEvents = params.reactionsSummaryEvents ) } else { null @@ -78,7 +80,8 @@ class CallItemFactory @Inject constructor( highlight = params.isHighlighted, informationData = informationData, isStillActive = callEventGrouper.isRinging(), - formattedDuration = callEventGrouper.formattedDuration() + formattedDuration = callEventGrouper.formattedDuration(), + reactionsSummaryEvents = params.reactionsSummaryEvents ) } else { null @@ -94,7 +97,8 @@ class CallItemFactory @Inject constructor( highlight = params.isHighlighted, informationData = informationData, isStillActive = false, - formattedDuration = callEventGrouper.formattedDuration() + formattedDuration = callEventGrouper.formattedDuration(), + reactionsSummaryEvents = params.reactionsSummaryEvents ) } EventType.CALL_HANGUP -> { @@ -111,7 +115,8 @@ class CallItemFactory @Inject constructor( highlight = params.isHighlighted, informationData = informationData, isStillActive = false, - formattedDuration = callEventGrouper.formattedDuration() + formattedDuration = callEventGrouper.formattedDuration(), + reactionsSummaryEvents = params.reactionsSummaryEvents ) } else -> null @@ -133,10 +138,11 @@ class CallItemFactory @Inject constructor( highlight: Boolean, isStillActive: Boolean, formattedDuration: String, - callback: TimelineEventController.Callback? + callback: TimelineEventController.Callback?, + reactionsSummaryEvents: ReactionsSummaryEvents? ): CallTileTimelineItem? { val userOfInterest = roomSummary.toMatrixItem() - val attributes = messageItemAttributesFactory.create(null, informationData, callback).let { + val attributes = messageItemAttributesFactory.create(null, informationData, callback, reactionsSummaryEvents).let { CallTileTimelineItem.Attributes( callId = callId, callKind = callKind, @@ -151,7 +157,8 @@ class CallItemFactory @Inject constructor( readReceiptsCallback = it.readReceiptsCallback, userOfInterest = userOfInterest, callback = callback, - isStillActive = isStillActive + isStillActive = isStillActive, + reactionsSummaryEvents = reactionsSummaryEvents ) } return CallTileTimelineItem_() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt index bc2497392c..2b04600af2 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt @@ -111,7 +111,9 @@ class EncryptedItemFactory @Inject constructor(private val messageInformationDat messageContent = event.root.content.toModel(), informationData = informationData, callback = params.callback, - threadDetails = threadDetails) + threadDetails = threadDetails, + reactionsSummaryEvents = params.reactionsSummaryEvents + ) return MessageTextItem_() .layout(informationData.messageLayout.layoutRes) .leftGuideline(avatarSizeProvider.leftGuideline) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt index 0ff786d504..0cb86a5c1c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/EncryptionItemFactory.kt @@ -46,7 +46,7 @@ class EncryptionItemFactory @Inject constructor( } val algorithm = event.root.content.toModel()?.algorithm val informationData = informationDataFactory.create(params) - val attributes = messageItemAttributesFactory.create(null, informationData, params.callback) + val attributes = messageItemAttributesFactory.create(null, informationData, params.callback, params.reactionsSummaryEvents) val isSafeAlgorithm = algorithm == MXCRYPTO_ALGORITHM_MEGOLM val title: String @@ -80,7 +80,8 @@ class EncryptionItemFactory @Inject constructor( itemClickListener = attributes.itemClickListener, itemLongClickListener = attributes.itemLongClickListener, reactionPillCallback = attributes.reactionPillCallback, - readReceiptsCallback = attributes.readReceiptsCallback + readReceiptsCallback = attributes.readReceiptsCallback, + reactionsSummaryEvents = attributes.reactionsSummaryEvents ) ) .highlighted(params.isHighlighted) 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 aa1758dd6c..2890e070ef 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 @@ -155,7 +155,7 @@ class MessageItemFactory @Inject constructor( if (event.root.isRedacted()) { // message is redacted - val attributes = messageItemAttributesFactory.create(null, informationData, callback, threadDetails) + val attributes = messageItemAttributesFactory.create(null, informationData, callback, params.reactionsSummaryEvents) return buildRedactedItem(attributes, highlight) } @@ -177,7 +177,7 @@ class MessageItemFactory @Inject constructor( } // always hide summary when we are on thread timeline - val attributes = messageItemAttributesFactory.create(messageContent, informationData, callback, threadDetails) + val attributes = messageItemAttributesFactory.create(messageContent, informationData, callback, params.reactionsSummaryEvents, threadDetails) // val all = event.root.toContent() // val ev = all.toModel() @@ -413,7 +413,8 @@ class MessageItemFactory @Inject constructor( itemClickListener = attributes.itemClickListener, reactionPillCallback = attributes.reactionPillCallback, readReceiptsCallback = attributes.readReceiptsCallback, - emojiTypeFace = attributes.emojiTypeFace + emojiTypeFace = attributes.emojiTypeFace, + reactionsSummaryEvents = attributes.reactionsSummaryEvents ) ) .callback(callback) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactoryParams.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactoryParams.kt index 46ae01a794..7c02b6f058 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactoryParams.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/TimelineItemFactoryParams.kt @@ -18,6 +18,7 @@ package im.vector.app.features.home.room.detail.timeline.factory import im.vector.app.features.home.room.detail.timeline.TimelineEventController import im.vector.app.features.home.room.detail.timeline.helper.TimelineEventsGroup +import im.vector.app.features.home.room.detail.timeline.item.ReactionsSummaryEvents import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent data class TimelineItemFactoryParams( @@ -29,6 +30,7 @@ data class TimelineItemFactoryParams( val partialState: TimelineEventController.PartialState = TimelineEventController.PartialState(), val lastSentEventIdWithoutReadReceipts: String? = null, val callback: TimelineEventController.Callback? = null, + val reactionsSummaryEvents: ReactionsSummaryEvents? = null, val eventsGroup: TimelineEventsGroup? = null ) { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/VerificationItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/VerificationItemFactory.kt index bdc6906593..16cf73cbb0 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/VerificationItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/VerificationItemFactory.kt @@ -71,10 +71,10 @@ class VerificationItemFactory @Inject constructor( // If it's not a request ignore this event // if (refEvent.root.getClearContent().toModel() == null) return ignoredConclusion(event, highlight, callback) - val referenceInformationData = messageInformationDataFactory.create(TimelineItemFactoryParams(refEvent)) + val referenceInformationData = messageInformationDataFactory.create(TimelineItemFactoryParams(event = refEvent)) val informationData = messageInformationDataFactory.create(params) - val attributes = messageItemAttributesFactory.create(null, informationData, params.callback) + val attributes = messageItemAttributesFactory.create(null, informationData, params.callback, params.reactionsSummaryEvents) when (event.root.getClearType()) { EventType.KEY_VERIFICATION_CANCEL -> { @@ -100,7 +100,8 @@ class VerificationItemFactory @Inject constructor( itemClickListener = attributes.itemClickListener, itemLongClickListener = attributes.itemLongClickListener, reactionPillCallback = attributes.reactionPillCallback, - readReceiptsCallback = attributes.readReceiptsCallback + readReceiptsCallback = attributes.readReceiptsCallback, + reactionsSummaryEvents = attributes.reactionsSummaryEvents ) ) .highlighted(params.isHighlighted) @@ -133,7 +134,8 @@ class VerificationItemFactory @Inject constructor( itemClickListener = attributes.itemClickListener, itemLongClickListener = attributes.itemLongClickListener, reactionPillCallback = attributes.reactionPillCallback, - readReceiptsCallback = attributes.readReceiptsCallback + readReceiptsCallback = attributes.readReceiptsCallback, + reactionsSummaryEvents = attributes.reactionsSummaryEvents ) ) .highlighted(params.isHighlighted) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt index a08383315c..647b34c626 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/factory/WidgetItemFactory.kt @@ -88,7 +88,8 @@ class WidgetItemFactory @Inject constructor( userOfInterest = userOfInterest, callback = params.callback, isStillActive = isCallStillActive, - formattedDuration = "" + formattedDuration = "", + reactionsSummaryEvents = params.reactionsSummaryEvents ) return CallTileTimelineItem_() .attributes(attributes) 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 59b39d17ef..97b3a8f445 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 @@ -93,7 +93,7 @@ class MessageInformationDataFactory @Inject constructor(private val session: Ses avatarUrl = event.senderInfo.avatarUrl, memberName = event.senderInfo.disambiguatedDisplayName, messageLayout = messageLayout, - reactionsSummary = reactionsSummaryFactory.create(event, params.callback), + reactionsSummary = reactionsSummaryFactory.create(event), pollResponseAggregatedSummary = event.annotations?.pollResponseSummary?.let { PollResponseData( myVote = it.aggregatedContent?.myVote, 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 845b765101..426561054b 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 @@ -24,6 +24,7 @@ import im.vector.app.features.home.room.detail.timeline.MessageColorProvider import im.vector.app.features.home.room.detail.timeline.TimelineEventController import im.vector.app.features.home.room.detail.timeline.item.AbsMessageItem import im.vector.app.features.home.room.detail.timeline.item.MessageInformationData +import im.vector.app.features.home.room.detail.timeline.item.ReactionsSummaryEvents import org.matrix.android.sdk.api.session.threads.ThreadDetails import javax.inject.Inject @@ -38,6 +39,7 @@ class MessageItemAttributesFactory @Inject constructor( fun create(messageContent: Any?, informationData: MessageInformationData, callback: TimelineEventController.Callback?, + reactionsSummaryEvents: ReactionsSummaryEvents?, threadDetails: ThreadDetails? = null): AbsMessageItem.Attributes { return AbsMessageItem.Attributes( avatarSize = avatarSizeProvider.avatarSize, @@ -60,6 +62,7 @@ class MessageItemAttributesFactory @Inject constructor( emojiTypeFace = emojiCompatFontProvider.typeface, decryptionErrorMessage = stringProvider.getString(R.string.encrypted_message), threadDetails = threadDetails, + reactionsSummaryEvents = reactionsSummaryEvents, areThreadMessagesEnabled = preferencesProvider.areThreadMessagesEnabled() ) } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ReactionsSummaryFactory.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ReactionsSummaryFactory.kt index fcc98ff729..3ba5997ee3 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ReactionsSummaryFactory.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/ReactionsSummaryFactory.kt @@ -34,7 +34,7 @@ class ReactionsSummaryFactory @Inject constructor() { return eventsRequestingBuild.remove(event.eventId) } - fun create(event: TimelineEvent, callback: TimelineEventController.Callback?): ReactionsSummaryData { + fun create(event: TimelineEvent): ReactionsSummaryData { val eventId = event.eventId val showAllStates = showAllReactionsByEvent.contains(eventId) val reactions = event.annotations?.reactionsSummary @@ -43,21 +43,24 @@ class ReactionsSummaryFactory @Inject constructor() { } return ReactionsSummaryData( reactions = reactions, - showAll = showAllStates, - onShowMoreClicked = { - showAllReactionsByEvent.add(eventId) - onRequestBuild(eventId) - }, - onShowLessClicked = { - showAllReactionsByEvent.remove(eventId) - onRequestBuild(eventId) - }, - onAddMoreClicked = { - callback?.onAddMoreReaction(event) - } + showAll = showAllStates ) } + fun onAddMoreClicked(callback: TimelineEventController.Callback?, event: TimelineEvent) { + callback?.onAddMoreReaction(event) + } + + fun onShowMoreClicked(eventId: String) { + showAllReactionsByEvent.add(eventId) + onRequestBuild(eventId) + } + + fun onShowLessClicked(eventId: String) { + showAllReactionsByEvent.remove(eventId) + onRequestBuild(eventId) + } + private fun onRequestBuild(eventId: String) { eventsRequestingBuild.add(eventId) onRequestBuild?.invoke() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt index 430e0970bb..4f08c9d05f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/AbsBaseMessageItem.kt @@ -121,18 +121,24 @@ abstract class AbsBaseMessageItem : BaseEventItem val showReactionsTextView = createReactionTextView(holder) if (reactionsSummary.showAll) { showReactionsTextView.setText(R.string.message_reaction_show_less) - showReactionsTextView.onClick { reactionsSummary.onShowLessClicked() } + showReactionsTextView.onClick { + baseAttributes.reactionsSummaryEvents?.onShowLessClicked?.invoke() + } } else { val moreCount = reactions.count() - MAX_REACTIONS_TO_SHOW showReactionsTextView.text = holder.view.resources.getQuantityString(R.plurals.message_reaction_show_more, moreCount, moreCount) - showReactionsTextView.onClick { reactionsSummary.onShowMoreClicked() } + showReactionsTextView.onClick { + baseAttributes.reactionsSummaryEvents?.onShowMoreClicked?.invoke() + } } holder.reactionsContainer.addView(showReactionsTextView) } val addMoreReactionsTextView = createReactionTextView(holder) addMoreReactionsTextView.text = holder.view.context.getDrawableAsSpannable(R.drawable.ic_add_reaction_small) - addMoreReactionsTextView.onClick { reactionsSummary.onAddMoreClicked() } + addMoreReactionsTextView.onClick { + baseAttributes.reactionsSummaryEvents?.onAddMoreClicked?.invoke() + } holder.reactionsContainer.addView(addMoreReactionsTextView) holder.reactionsContainer.setOnLongClickListener(baseAttributes.itemLongClickListener) } @@ -180,6 +186,7 @@ abstract class AbsBaseMessageItem : BaseEventItem // val memberClickListener: ClickListener? val reactionPillCallback: TimelineEventController.ReactionPillCallback? + val reactionsSummaryEvents: ReactionsSummaryEvents? // val avatarCallback: TimelineEventController.AvatarCallback? val readReceiptsCallback: TimelineEventController.ReadReceiptsCallback? 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 9e8f86c26e..e3ae91bf0b 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 @@ -184,7 +184,8 @@ abstract class AbsMessageItem : AbsBaseMessageItem val emojiTypeFace: Typeface? = null, val decryptionErrorMessage: String? = null, val threadDetails: ThreadDetails? = null, - val areThreadMessagesEnabled: Boolean = false + val areThreadMessagesEnabled: Boolean = false, + override val reactionsSummaryEvents: ReactionsSummaryEvents? = null, ) : AbsBaseMessageItem.Attributes { // Have to override as it's used to diff epoxy items diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt index 6db0b0c380..ea130901b1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/CallTileTimelineItem.kt @@ -263,7 +263,8 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem? = null, - val showAll: Boolean = false, + val showAll: Boolean = false +) : Parcelable + +data class ReactionsSummaryEvents( val onShowMoreClicked: () -> Unit, val onShowLessClicked: () -> Unit, val onAddMoreClicked: () -> Unit -) : Parcelable +) @Parcelize data class ReactionInfoData( diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt index fdde087b44..2d9119f14c 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/StatusTileTimelineItem.kt @@ -93,7 +93,8 @@ abstract class StatusTileTimelineItem : AbsBaseMessageItem + +