mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 05:26:48 +00:00
Merge commit 'abe886286486b656581a7e67f6e5857b8ee0f9f6'
# Conflicts: # submodules/TgVoipWebrtc/tgcalls # third-party/webrtc/webrtc
This commit is contained in:
commit
8cba0f86cf
@ -1 +1 @@
|
|||||||
Subproject commit a448644dce247e59268864fd66b6578195412b59
|
Subproject commit c1f83903e864d753477e51d66d3ada6c2c6d096f
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 4ebd7cc45edfe6c525c1553a0f5294895653c9df
|
Subproject commit fcbfcfad2d633b6c8be85954975db88bee3fa26c
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit e850484071d2b8dc41685a62d3567c312173f3c3
|
Subproject commit 03c89782e9a15d467c7e036ee36f9adb6bdda910
|
||||||
@ -1 +1 @@
|
|||||||
Subproject commit 4eb4edc06eef85d0a4593f36e8fe34e33f718018
|
Subproject commit ec7dd9ddf4b73dedb02df827b7ab3b2cbb1f2ac0
|
||||||
@ -1,5 +1,9 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
#if !os(macOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
import CoreMedia
|
import CoreMedia
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import FFMpegBinding
|
import FFMpegBinding
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
#if !os(macOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
|
|||||||
32
submodules/OpenSSLEncryptionProvider/Package.swift
Normal file
32
submodules/OpenSSLEncryptionProvider/Package.swift
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// swift-tools-version:5.5
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "OpenSSLEncryption",
|
||||||
|
platforms: [
|
||||||
|
.macOS(.v10_11)
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
.library(
|
||||||
|
name: "OpenSSLEncryption",
|
||||||
|
targets: ["OpenSSLEncryption"]),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "OpenSSLEncryption",
|
||||||
|
dependencies: [],
|
||||||
|
path: ".",
|
||||||
|
exclude: ["BUILD"],
|
||||||
|
publicHeadersPath: "PublicHeaders",
|
||||||
|
cSettings: [
|
||||||
|
.headerSearchPath("PublicHeaders"),
|
||||||
|
.unsafeFlags([
|
||||||
|
"-I../../../../core-xprojects/openssl/build/openssl/include",
|
||||||
|
"-I../EncryptionProvider/PublicHeaders"
|
||||||
|
])
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
)
|
||||||
@ -610,7 +610,7 @@ struct AccountFinalState {
|
|||||||
struct AccountReplayedFinalState {
|
struct AccountReplayedFinalState {
|
||||||
let state: AccountFinalState
|
let state: AccountFinalState
|
||||||
let addedIncomingMessageIds: [MessageId]
|
let addedIncomingMessageIds: [MessageId]
|
||||||
let addedReactionEvents: [(reactionAuthor: Peer, message: Message, timestamp: Int32)]
|
let addedReactionEvents: [(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)]
|
||||||
let wasScheduledMessageIds: [MessageId]
|
let wasScheduledMessageIds: [MessageId]
|
||||||
let addedSecretMessageIds: [MessageId]
|
let addedSecretMessageIds: [MessageId]
|
||||||
let deletedMessageIds: [DeletedMessageId]
|
let deletedMessageIds: [DeletedMessageId]
|
||||||
@ -628,7 +628,7 @@ struct AccountReplayedFinalState {
|
|||||||
|
|
||||||
struct AccountFinalStateEvents {
|
struct AccountFinalStateEvents {
|
||||||
let addedIncomingMessageIds: [MessageId]
|
let addedIncomingMessageIds: [MessageId]
|
||||||
let addedReactionEvents: [(reactionAuthor: Peer, message: Message, timestamp: Int32)]
|
let addedReactionEvents: [(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)]
|
||||||
let wasScheduledMessageIds:[MessageId]
|
let wasScheduledMessageIds:[MessageId]
|
||||||
let deletedMessageIds: [DeletedMessageId]
|
let deletedMessageIds: [DeletedMessageId]
|
||||||
let updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]]
|
let updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]]
|
||||||
@ -651,7 +651,7 @@ struct AccountFinalStateEvents {
|
|||||||
return self.addedIncomingMessageIds.isEmpty && self.addedReactionEvents.isEmpty && self.wasScheduledMessageIds.isEmpty && self.deletedMessageIds.isEmpty && self.updatedTypingActivities.isEmpty && self.updatedWebpages.isEmpty && self.updatedCalls.isEmpty && self.addedCallSignalingData.isEmpty && self.updatedGroupCallParticipants.isEmpty && self.updatedPeersNearby?.isEmpty ?? true && self.isContactUpdates.isEmpty && self.displayAlerts.isEmpty && self.delayNotificatonsUntil == nil && self.updatedMaxMessageId == nil && self.updatedQts == nil && self.externallyUpdatedPeerId.isEmpty && !authorizationListUpdated && self.updatedIncomingThreadReadStates.isEmpty && self.updatedOutgoingThreadReadStates.isEmpty
|
return self.addedIncomingMessageIds.isEmpty && self.addedReactionEvents.isEmpty && self.wasScheduledMessageIds.isEmpty && self.deletedMessageIds.isEmpty && self.updatedTypingActivities.isEmpty && self.updatedWebpages.isEmpty && self.updatedCalls.isEmpty && self.addedCallSignalingData.isEmpty && self.updatedGroupCallParticipants.isEmpty && self.updatedPeersNearby?.isEmpty ?? true && self.isContactUpdates.isEmpty && self.displayAlerts.isEmpty && self.delayNotificatonsUntil == nil && self.updatedMaxMessageId == nil && self.updatedQts == nil && self.externallyUpdatedPeerId.isEmpty && !authorizationListUpdated && self.updatedIncomingThreadReadStates.isEmpty && self.updatedOutgoingThreadReadStates.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
init(addedIncomingMessageIds: [MessageId] = [], addedReactionEvents: [(reactionAuthor: Peer, message: Message, timestamp: Int32)] = [], wasScheduledMessageIds: [MessageId] = [], deletedMessageIds: [DeletedMessageId] = [], updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]] = [:], updatedWebpages: [MediaId: TelegramMediaWebpage] = [:], updatedCalls: [Api.PhoneCall] = [], addedCallSignalingData: [(Int64, Data)] = [], updatedGroupCallParticipants: [(Int64, GroupCallParticipantsContext.Update)] = [], updatedPeersNearby: [PeerNearby]? = nil, isContactUpdates: [(PeerId, Bool)] = [], displayAlerts: [(text: String, isDropAuth: Bool)] = [], delayNotificatonsUntil: Int32? = nil, updatedMaxMessageId: Int32? = nil, updatedQts: Int32? = nil, externallyUpdatedPeerId: Set<PeerId> = Set(), authorizationListUpdated: Bool = false, updatedIncomingThreadReadStates: [MessageId: MessageId.Id] = [:], updatedOutgoingThreadReadStates: [MessageId: MessageId.Id] = [:]) {
|
init(addedIncomingMessageIds: [MessageId] = [], addedReactionEvents: [(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)] = [], wasScheduledMessageIds: [MessageId] = [], deletedMessageIds: [DeletedMessageId] = [], updatedTypingActivities: [PeerActivitySpace: [PeerId: PeerInputActivity?]] = [:], updatedWebpages: [MediaId: TelegramMediaWebpage] = [:], updatedCalls: [Api.PhoneCall] = [], addedCallSignalingData: [(Int64, Data)] = [], updatedGroupCallParticipants: [(Int64, GroupCallParticipantsContext.Update)] = [], updatedPeersNearby: [PeerNearby]? = nil, isContactUpdates: [(PeerId, Bool)] = [], displayAlerts: [(text: String, isDropAuth: Bool)] = [], delayNotificatonsUntil: Int32? = nil, updatedMaxMessageId: Int32? = nil, updatedQts: Int32? = nil, externallyUpdatedPeerId: Set<PeerId> = Set(), authorizationListUpdated: Bool = false, updatedIncomingThreadReadStates: [MessageId: MessageId.Id] = [:], updatedOutgoingThreadReadStates: [MessageId: MessageId.Id] = [:]) {
|
||||||
self.addedIncomingMessageIds = addedIncomingMessageIds
|
self.addedIncomingMessageIds = addedIncomingMessageIds
|
||||||
self.addedReactionEvents = addedReactionEvents
|
self.addedReactionEvents = addedReactionEvents
|
||||||
self.wasScheduledMessageIds = wasScheduledMessageIds
|
self.wasScheduledMessageIds = wasScheduledMessageIds
|
||||||
|
|||||||
@ -4,6 +4,43 @@ import SwiftSignalKit
|
|||||||
import TelegramApi
|
import TelegramApi
|
||||||
import MtProtoKit
|
import MtProtoKit
|
||||||
|
|
||||||
|
private func reactionGeneratedEvent(_ previousReactions: ReactionsMessageAttribute?, _ updatedReactions: ReactionsMessageAttribute?, message: Message, transaction: Transaction) -> (reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)? {
|
||||||
|
|
||||||
|
if let updatedReactions = updatedReactions, !message.flags.contains(.Incoming), message.id.peerId.namespace == Namespaces.Peer.CloudUser {
|
||||||
|
let prev = previousReactions?.reactions ?? []
|
||||||
|
|
||||||
|
let updated = updatedReactions.reactions.filter { value in
|
||||||
|
return !prev.contains(where: {
|
||||||
|
$0.value == value.value && $0.count == value.count
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let myUpdated = updatedReactions.reactions.filter { value in
|
||||||
|
return value.isSelected
|
||||||
|
}.first
|
||||||
|
let myPrevious = prev.filter { value in
|
||||||
|
return value.isSelected
|
||||||
|
}.first
|
||||||
|
|
||||||
|
let previousCount = prev.reduce(0, {
|
||||||
|
$0 + $1.count
|
||||||
|
})
|
||||||
|
let updatedCount = updatedReactions.reactions.reduce(0, {
|
||||||
|
$0 + $1.count
|
||||||
|
})
|
||||||
|
|
||||||
|
let newReaction = updated.filter {
|
||||||
|
!$0.isSelected
|
||||||
|
}.first?.value
|
||||||
|
|
||||||
|
if !updated.isEmpty && myUpdated == myPrevious, updatedCount >= previousCount, let value = newReaction {
|
||||||
|
if let reactionAuthor = transaction.getPeer(message.id.peerId) {
|
||||||
|
return (reactionAuthor: reactionAuthor, reaction: value, message: message, timestamp: Int32(Date().timeIntervalSince1970))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<PeerId> {
|
private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<PeerId> {
|
||||||
var peerIds = Set<PeerId>()
|
var peerIds = Set<PeerId>()
|
||||||
@ -2430,7 +2467,7 @@ func replayFinalState(
|
|||||||
}
|
}
|
||||||
var wasScheduledMessageIds:[MessageId] = []
|
var wasScheduledMessageIds:[MessageId] = []
|
||||||
var addedIncomingMessageIds: [MessageId] = []
|
var addedIncomingMessageIds: [MessageId] = []
|
||||||
var addedReactionEvents: [(reactionAuthor: Peer, message: Message, timestamp: Int32)] = []
|
var addedReactionEvents: [(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)] = []
|
||||||
|
|
||||||
if !wasOperationScheduledMessageIds.isEmpty {
|
if !wasOperationScheduledMessageIds.isEmpty {
|
||||||
let existingIds = transaction.filterStoredMessageIds(Set(wasOperationScheduledMessageIds))
|
let existingIds = transaction.filterStoredMessageIds(Set(wasOperationScheduledMessageIds))
|
||||||
@ -2670,6 +2707,7 @@ func replayFinalState(
|
|||||||
invalidateGroupStats.insert(Namespaces.PeerGroup.archive)
|
invalidateGroupStats.insert(Namespaces.PeerGroup.archive)
|
||||||
}
|
}
|
||||||
case let .EditMessage(id, message):
|
case let .EditMessage(id, message):
|
||||||
|
var generatedEvent: (reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)?
|
||||||
transaction.updateMessage(id, update: { previousMessage in
|
transaction.updateMessage(id, update: { previousMessage in
|
||||||
var updatedFlags = message.flags
|
var updatedFlags = message.flags
|
||||||
var updatedLocalTags = message.localTags
|
var updatedLocalTags = message.localTags
|
||||||
@ -2681,8 +2719,21 @@ func replayFinalState(
|
|||||||
} else {
|
} else {
|
||||||
updatedFlags.remove(.Incoming)
|
updatedFlags.remove(.Incoming)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let peers: [PeerId:Peer] = previousMessage.peers.reduce([:], { current, value in
|
||||||
|
var current = current
|
||||||
|
current[value.0] = value.1
|
||||||
|
return current
|
||||||
|
})
|
||||||
|
|
||||||
|
if let message = locallyRenderedMessage(message: message, peers: peers) {
|
||||||
|
generatedEvent = reactionGeneratedEvent(previousMessage.reactionsAttribute, message.reactionsAttribute, message: message, transaction: transaction)
|
||||||
|
}
|
||||||
return .update(message.withUpdatedLocalTags(updatedLocalTags).withUpdatedFlags(updatedFlags))
|
return .update(message.withUpdatedLocalTags(updatedLocalTags).withUpdatedFlags(updatedFlags))
|
||||||
})
|
})
|
||||||
|
if let generatedEvent = generatedEvent {
|
||||||
|
addedReactionEvents.append(generatedEvent)
|
||||||
|
}
|
||||||
case let .UpdateMessagePoll(pollId, apiPoll, results):
|
case let .UpdateMessagePoll(pollId, apiPoll, results):
|
||||||
if let poll = transaction.getMedia(pollId) as? TelegramMediaPoll {
|
if let poll = transaction.getMedia(pollId) as? TelegramMediaPoll {
|
||||||
var updatedPoll = poll
|
var updatedPoll = poll
|
||||||
@ -3230,7 +3281,7 @@ func replayFinalState(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
case let .UpdateMessageReactions(messageId, reactions, eventTimestamp):
|
case let .UpdateMessageReactions(messageId, reactions, eventTimestamp):
|
||||||
var generatedEvent: (reactionAuthor: Peer, message: Message, timestamp: Int32)?
|
var generatedEvent: (reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)?
|
||||||
transaction.updateMessage(messageId, update: { currentMessage in
|
transaction.updateMessage(messageId, update: { currentMessage in
|
||||||
var updatedReactions = ReactionsMessageAttribute(apiReactions: reactions)
|
var updatedReactions = ReactionsMessageAttribute(apiReactions: reactions)
|
||||||
|
|
||||||
@ -3254,45 +3305,9 @@ func replayFinalState(
|
|||||||
if !added {
|
if !added {
|
||||||
attributes.append(updatedReactions)
|
attributes.append(updatedReactions)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eventTimestamp = eventTimestamp, !currentMessage.flags.contains(.Incoming), let chatPeer = currentMessage.peers[currentMessage.id.peerId] {
|
|
||||||
let _ = chatPeer
|
|
||||||
|
|
||||||
var previousCount = 0
|
|
||||||
if let previousReactions = previousReactions {
|
|
||||||
for reaction in previousReactions.reactions {
|
|
||||||
previousCount += Int(reaction.count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var updatedCount = 0
|
|
||||||
for reaction in updatedReactions.reactions {
|
|
||||||
updatedCount += Int(reaction.count)
|
|
||||||
}
|
|
||||||
|
|
||||||
if updatedCount > previousCount {
|
|
||||||
if let topPeer = updatedReactions.recentPeers.last {
|
|
||||||
var wasPresentBefore = false
|
|
||||||
if let previousReactions = previousReactions {
|
|
||||||
for recentPeer in previousReactions.recentPeers {
|
|
||||||
if recentPeer.peerId == topPeer.peerId {
|
|
||||||
wasPresentBefore = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !wasPresentBefore, let reactionAuthor = transaction.getPeer(topPeer.peerId), transaction.isPeerContact(peerId: topPeer.peerId) {
|
|
||||||
generatedEvent = (reactionAuthor: reactionAuthor, message: currentMessage.withUpdatedAttributes(attributes), timestamp: eventTimestamp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
|
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
|
||||||
})
|
})
|
||||||
if let generatedEvent = generatedEvent {
|
|
||||||
addedReactionEvents.append(generatedEvent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,8 +105,8 @@ public final class AccountStateManager {
|
|||||||
return self.notificationMessagesPipe.signal()
|
return self.notificationMessagesPipe.signal()
|
||||||
}
|
}
|
||||||
|
|
||||||
private let reactionNotificationsPipe = ValuePipe<[(reactionAuthor: Peer, message: Message)]>()
|
private let reactionNotificationsPipe = ValuePipe<[(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)]>()
|
||||||
public var reactionNotifications: Signal<[(reactionAuthor: Peer, message: Message)], NoError> {
|
public var reactionNotifications: Signal<[(reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)], NoError> {
|
||||||
return self.reactionNotificationsPipe.signal()
|
return self.reactionNotificationsPipe.signal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,16 +746,15 @@ public final class AccountStateManager {
|
|||||||
|
|
||||||
let timestamp = Int32(Date().timeIntervalSince1970)
|
let timestamp = Int32(Date().timeIntervalSince1970)
|
||||||
let minReactionTimestamp = timestamp - 20
|
let minReactionTimestamp = timestamp - 20
|
||||||
let reactionEvents = events.addedReactionEvents.compactMap { event -> (reactionAuthor: Peer, message: Message)? in
|
let reactionEvents = events.addedReactionEvents.compactMap { event -> (reactionAuthor: Peer, reaction: String, message: Message, timestamp: Int32)? in
|
||||||
if event.timestamp >= minReactionTimestamp {
|
if event.timestamp >= minReactionTimestamp {
|
||||||
return (event.reactionAuthor, event.message)
|
return (event.reactionAuthor, event.reaction, event.message, event.timestamp)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !reactionEvents.isEmpty {
|
self.reactionNotificationsPipe.putNext(reactionEvents)
|
||||||
self.reactionNotificationsPipe.putNext(reactionEvents)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !events.displayAlerts.isEmpty {
|
if !events.displayAlerts.isEmpty {
|
||||||
self.displayAlertsPipe.putNext(events.displayAlerts)
|
self.displayAlertsPipe.putNext(events.displayAlerts)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ public func updateMessageReactionsInteractively(account: Account, messageId: Mes
|
|||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes.append(PendingReactionsMessageAttribute(accountPeerId: account.peerId, value: reaction))
|
attributes.append(PendingReactionsMessageAttribute(accountPeerId: account.peerId, value: reaction))
|
||||||
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
|
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
|
||||||
})
|
})
|
||||||
@ -245,7 +246,9 @@ public extension EngineMessageReactionListContext.State {
|
|||||||
}
|
}
|
||||||
for recentPeer in reactionsAttribute.recentPeers {
|
for recentPeer in reactionsAttribute.recentPeers {
|
||||||
if let peer = message.peers[recentPeer.peerId] {
|
if let peer = message.peers[recentPeer.peerId] {
|
||||||
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value))
|
if reaction == nil || recentPeer.value == reaction {
|
||||||
|
items.append(EngineMessageReactionListContext.Item(peer: EnginePeer(peer), reaction: recentPeer.value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,6 +340,8 @@ public final class EngineMessageReactionListContext {
|
|||||||
|
|
||||||
if initialState.canLoadMore {
|
if initialState.canLoadMore {
|
||||||
self.loadMore()
|
self.loadMore()
|
||||||
|
} else {
|
||||||
|
self.statePromise.set(.single(self.state))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ public struct ProxyServerSettings: Codable, Equatable, Hashable {
|
|||||||
|
|
||||||
public func hash(into hasher: inout Hasher) {
|
public func hash(into hasher: inout Hasher) {
|
||||||
hasher.combine(self.host)
|
hasher.combine(self.host)
|
||||||
|
hasher.combine(self.port)
|
||||||
hasher.combine(self.connection)
|
hasher.combine(self.connection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,11 +7,6 @@ public struct MessageReaction: Equatable, PostboxCoding {
|
|||||||
|
|
||||||
public init(value: String, count: Int32, isSelected: Bool) {
|
public init(value: String, count: Int32, isSelected: Bool) {
|
||||||
var value = value
|
var value = value
|
||||||
|
|
||||||
if value == "❤️" {
|
|
||||||
value = "❤"
|
|
||||||
}
|
|
||||||
|
|
||||||
self.value = value
|
self.value = value
|
||||||
self.count = count
|
self.count = count
|
||||||
self.isSelected = isSelected
|
self.isSelected = isSelected
|
||||||
|
|||||||
@ -322,6 +322,19 @@ public extension Message {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
var hasReactions: Bool {
|
||||||
|
for attribute in self.attributes {
|
||||||
|
if let attribute = attribute as? ReactionsMessageAttribute {
|
||||||
|
return !attribute.reactions.isEmpty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for attribute in self.attributes {
|
||||||
|
if let attribute = attribute as? PendingReactionsMessageAttribute {
|
||||||
|
return attribute.value != nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var textEntitiesAttribute: TextEntitiesMessageAttribute? {
|
var textEntitiesAttribute: TextEntitiesMessageAttribute? {
|
||||||
for attribute in self.attributes {
|
for attribute in self.attributes {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user