mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Refactoring
This commit is contained in:
@@ -1,26 +1 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
|
||||
|
||||
public func updatePeerChatInterfaceState(account: Account, peerId: PeerId, threadId: Int64?, state: SynchronizeableChatInterfaceState) -> Signal<Void, NoError> {
|
||||
return account.postbox.transaction { transaction -> Void in
|
||||
if let threadId = threadId {
|
||||
transaction.updatePeerChatThreadInterfaceState(peerId, threadId: threadId, update: { _ in
|
||||
return state
|
||||
})
|
||||
} else {
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user