mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-04 03:40:45 +00:00
25 lines
778 B
Swift
25 lines
778 B
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import SwiftSignalKitMac
|
|
#else
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
#endif
|
|
|
|
public func removePeerChat(postbox: Postbox, peerId: PeerId) -> Signal<Void, NoError> {
|
|
return postbox.modify { modifier -> Void in
|
|
if peerId.namespace == Namespaces.Peer.SecretChat {
|
|
|
|
} else {
|
|
cloudChatAddRemoveChatOperation(modifier: modifier, peerId: peerId)
|
|
if peerId.namespace == Namespaces.Peer.CloudUser {
|
|
modifier.updatePeerChatListInclusion(peerId, inclusion: .ifHasMessages)
|
|
modifier.clearHistory(peerId)
|
|
} else {
|
|
modifier.updatePeerChatListInclusion(peerId, inclusion: .never)
|
|
}
|
|
}
|
|
}
|
|
}
|