Sort reactions on the timeline by count and then timestamp and show the date on the summary view (#1320)

* Sort timetamps on timeline and show the date on the summary view

- Sort reaction aggregations on the timeline by count and then by most recent timestamp ascending(tagging new reactions on the end)
- Show the timestamp on the summary view and sort descending(newest at the top)

* Address comments.

- Fix ID case.
- Improve readability of components in body.
- Improve the comments that describe the sorting.
This commit is contained in:
David Langley
2023-07-14 17:18:32 +01:00
committed by GitHub
parent eaf8079339
commit a44a60cb0a
6 changed files with 80 additions and 37 deletions
@@ -23,42 +23,50 @@ extension AggregatedReaction {
}
}
private static func mockReaction(key: String, senderIDs: [String]) -> AggregatedReaction {
let senders = senderIDs
.map { id in
ReactionSender(senderID: id, timestamp: Date())
}
return AggregatedReaction(accountOwnerID: alice, key: key, senders: senders)
}
private static var alice: String {
RoomMemberProxyMock.mockAlice.userID
}
static var mockThumbsUpHighlighted: AggregatedReaction {
AggregatedReaction(accountOwnerID: alice, key: "👍", senders: [alice] + mockIds(4))
mockReaction(key: "👍", senderIDs: [alice] + mockIds(4))
}
static var mockClap: AggregatedReaction {
AggregatedReaction(accountOwnerID: alice, key: "👏", senders: mockIds(1))
mockReaction(key: "👏", senderIDs: mockIds(1))
}
static var mockParty: AggregatedReaction {
AggregatedReaction(accountOwnerID: alice, key: "🎉", senders: mockIds(20))
mockReaction(key: "🎉", senderIDs: mockIds(20))
}
static var mockReactions: [AggregatedReaction] {
[
AggregatedReaction(accountOwnerID: alice, key: "😅", senders: [alice]),
AggregatedReaction(accountOwnerID: alice, key: "🤷‍♂️", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🎨", senders: [alice] + mockIds(5)),
AggregatedReaction(accountOwnerID: alice, key: "🎉", senders: mockIds(8)),
AggregatedReaction(accountOwnerID: alice, key: "🤯", senders: [alice] + mockIds(14)),
AggregatedReaction(accountOwnerID: alice, key: "🫣", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🚀", senders: [alice] + mockIds(3)),
AggregatedReaction(accountOwnerID: alice, key: "😇", senders: mockIds(2)),
AggregatedReaction(accountOwnerID: alice, key: "🤭", senders: [alice] + mockIds(8)),
AggregatedReaction(accountOwnerID: alice, key: "🫤", senders: mockIds(10)),
AggregatedReaction(accountOwnerID: alice, key: "🐶", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐱", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐭", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐹", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐰", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🦊", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐻", senders: mockIds(1)),
AggregatedReaction(accountOwnerID: alice, key: "🐼", senders: mockIds(1))
mockReaction(key: "😅", senderIDs: [alice]),
mockReaction(key: "🤷‍♂️", senderIDs: mockIds(1)),
mockReaction(key: "🎨", senderIDs: [alice] + mockIds(5)),
mockReaction(key: "🎉", senderIDs: mockIds(8)),
mockReaction(key: "🤯", senderIDs: [alice] + mockIds(14)),
mockReaction(key: "🫣", senderIDs: mockIds(1)),
mockReaction(key: "🚀", senderIDs: [alice] + mockIds(3)),
mockReaction(key: "😇", senderIDs: mockIds(2)),
mockReaction(key: "🤭", senderIDs: [alice] + mockIds(8)),
mockReaction(key: "🫤", senderIDs: mockIds(10)),
mockReaction(key: "🐶", senderIDs: mockIds(1)),
mockReaction(key: "🐱", senderIDs: mockIds(1)),
mockReaction(key: "🐭", senderIDs: mockIds(1)),
mockReaction(key: "🐹", senderIDs: mockIds(1)),
mockReaction(key: "🐰", senderIDs: mockIds(1)),
mockReaction(key: "🦊", senderIDs: mockIds(1)),
mockReaction(key: "🐻", senderIDs: mockIds(1)),
mockReaction(key: "🐼", senderIDs: mockIds(1))
]
}
}