Reaction summary view and sorting reactions by count and then timestamp (#942)

* Sort reactions by count and then timestamp

- Sort reactions within an aggregation by timestamp descending. This puts the most recent at the top, useful in cases like the reaction summary view or getting the most recent reaction.
- Sort aggregated reactions by count and then timestamp ascending, using the most recent reaction in the aggregation. This appends new aggregations on the end of the reaction layout.

* Add reaction summary view

* fix warnings

* Fix test unit tests and add sorting tests

- Fix broken build in test code
- Add a test for reaction sorting

* Remove default closure, move logic to presenter and add tests

* Update screenshots

* Fix imports

* Revert Screenshots I didn't update

* Fix imports remove screetshots

* Update screenshots

* Update screenshots

* Address comments.

* Update screenshots

* Remove unnecessary snapshotFlow

* Fix code quality checks

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
David Langley 2023-07-31 18:39:20 +01:00 committed by GitHub
parent ca3e284991
commit 0b95ef09b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 829 additions and 39 deletions

View file

@ -16,10 +16,7 @@
package io.element.android.libraries.matrix.api.timeline.item.event
import io.element.android.libraries.matrix.api.core.UserId
data class EventReaction(
val key: String,
val count: Long,
val senderIds: List<UserId>
val senders: List<ReactionSender>
)

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.matrix.api.timeline.item.event
import io.element.android.libraries.matrix.api.core.UserId
/**
* The sender of a reaction.
*
* @property senderId the ID of the user who sent the reaction
* @property timestamp the timestamp the reaction was received on the origin homeserver
*/
data class ReactionSender(
val senderId: UserId,
val timestamp: Long
)