mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
35 lines
1.0 KiB
Swift
35 lines
1.0 KiB
Swift
import Foundation
|
|
|
|
final class MutableContactPeerIdsView {
|
|
fileprivate var remoteTotalCount: Int32
|
|
fileprivate var peerIds: Set<PeerId>
|
|
|
|
init(remoteTotalCount: Int32, peerIds: Set<PeerId>) {
|
|
self.remoteTotalCount = remoteTotalCount
|
|
self.peerIds = peerIds
|
|
}
|
|
|
|
func replay(updateRemoteTotalCount: Int32?, replace replacePeerIds: Set<PeerId>) -> Bool {
|
|
var updated = false
|
|
if let updateRemoteTotalCount = updateRemoteTotalCount, self.remoteTotalCount != updateRemoteTotalCount {
|
|
self.remoteTotalCount = updateRemoteTotalCount
|
|
updated = true
|
|
}
|
|
if self.peerIds != replacePeerIds {
|
|
self.peerIds = replacePeerIds
|
|
updated = true
|
|
}
|
|
return updated
|
|
}
|
|
}
|
|
|
|
public final class ContactPeerIdsView {
|
|
public let remoteTotalCount: Int32
|
|
public let peerIds: Set<PeerId>
|
|
|
|
init(_ mutableView: MutableContactPeerIdsView) {
|
|
self.remoteTotalCount = mutableView.remoteTotalCount
|
|
self.peerIds = mutableView.peerIds
|
|
}
|
|
}
|