Power saving improvements

This commit is contained in:
Ali
2023-02-24 18:08:30 +04:00
parent 96496aabd9
commit de29a6b54b
55 changed files with 1551 additions and 411 deletions

View File

@@ -338,7 +338,7 @@ public extension EngineMessageReactionListContext.State {
for recentPeer in reactionsAttribute.recentPeers {
if let peer = message.peers[recentPeer.peerId] {
if reaction == nil || recentPeer.value == reaction {
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value))
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value, timestamp: nil))
}
}
}
@@ -359,13 +359,16 @@ public final class EngineMessageReactionListContext {
public final class Item: Equatable {
public let peer: EnginePeer
public let reaction: MessageReaction.Reaction?
public let timestamp: Int32?
public init(
peer: EnginePeer,
reaction: MessageReaction.Reaction?
reaction: MessageReaction.Reaction?,
timestamp: Int32?
) {
self.peer = peer
self.reaction = reaction
self.timestamp = timestamp
}
public static func ==(lhs: Item, rhs: Item) -> Bool {
@@ -375,6 +378,9 @@ public final class EngineMessageReactionListContext {
if lhs.reaction != rhs.reaction {
return false
}
if lhs.timestamp != rhs.timestamp {
return false
}
return true
}
}
@@ -503,7 +509,7 @@ public final class EngineMessageReactionListContext {
switch reaction {
case let .messagePeerReaction(_, peer, reaction):
if let peer = transaction.getPeer(peer.peerId), let reaction = MessageReaction.Reaction(apiReaction: reaction) {
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: reaction))
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: reaction, timestamp: nil))
}
}
}