mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-16 08:19:23 +00:00

git-subtree-dir: submodules/TelegramCore git-subtree-mainline: 971273e8f8f49a47f14b251d2f35e3445a61fc3f git-subtree-split: 9561227540acef69894e6546395ab223a6233600
25 lines
1021 B
Swift
25 lines
1021 B
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import SwiftSignalKitMac
|
|
#else
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
#endif
|
|
|
|
public func updatePeerChatInterfaceState(account: Account, peerId: PeerId, state: SynchronizeableChatInterfaceState) -> Signal<Void, NoError> {
|
|
return account.postbox.transaction { transaction -> Void in
|
|
let currentInputState = (transaction.getPeerChatInterfaceState(peerId) as? SynchronizeableChatInterfaceState)?.synchronizeableInputState
|
|
let updatedInputState = state.synchronizeableInputState
|
|
|
|
if currentInputState != updatedInputState {
|
|
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudChannel || peerId.namespace == Namespaces.Peer.CloudGroup {
|
|
addSynchronizeChatInputStateOperation(transaction: transaction, peerId: peerId)
|
|
}
|
|
}
|
|
transaction.updatePeerChatInterfaceState(peerId, update: { _ in
|
|
return state
|
|
})
|
|
}
|
|
}
|