mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Make timeline reactions and reaction senders identifiable
This commit is contained in:
committed by
Stefan Ceriu
parent
9bb177bff5
commit
2a33ee1f63
@@ -17,12 +17,16 @@
|
||||
import Foundation
|
||||
|
||||
/// Represents all reactions of the same type for a single event.
|
||||
struct AggregatedReaction: Hashable {
|
||||
struct AggregatedReaction: Hashable, Identifiable {
|
||||
/// Length at which we ellipsize a reaction key for display
|
||||
/// Reactions can be free text, so we need to limit the length
|
||||
/// displayed on screen.
|
||||
private static let maxDisplayChars = 16
|
||||
|
||||
var id: String {
|
||||
key
|
||||
}
|
||||
|
||||
/// The id of the account owner
|
||||
let accountOwnerID: String
|
||||
/// The reaction that was sent.
|
||||
@@ -32,9 +36,9 @@ struct AggregatedReaction: Hashable {
|
||||
}
|
||||
|
||||
/// Details of who sent the reaction
|
||||
struct ReactionSender: Hashable {
|
||||
struct ReactionSender: Hashable, Identifiable {
|
||||
/// The id of the user who sent the reaction
|
||||
let senderID: String
|
||||
let id: String
|
||||
/// The time that the reaction was received on the original homeserver
|
||||
let timestamp: Date
|
||||
}
|
||||
@@ -47,7 +51,7 @@ extension AggregatedReaction {
|
||||
|
||||
/// Whether to highlight the reaction, indicating that the current user sent this reaction.
|
||||
var isHighlighted: Bool {
|
||||
senders.contains(where: { $0.senderID == accountOwnerID })
|
||||
senders.contains(where: { $0.id == accountOwnerID })
|
||||
}
|
||||
|
||||
/// The key to be displayed on screen. See `maxDisplayChars`.
|
||||
|
||||
Reference in New Issue
Block a user