mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
no message
This commit is contained in:
parent
fe506d65a3
commit
be7fc683b6
@ -12,7 +12,7 @@
|
||||
<key>PostboxMac.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>5</integer>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>PostboxTests.xcscheme</key>
|
||||
<dict>
|
||||
|
@ -14,12 +14,8 @@ public struct ChatListHole: Hashable, CustomStringConvertible {
|
||||
public var hashValue: Int {
|
||||
return self.index.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
||||
return lhs.index == rhs.index
|
||||
}
|
||||
|
||||
public func <(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
||||
public static func <(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
||||
return lhs.index < rhs.index
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ public class MemoryBuffer: Equatable, CustomStringConvertible {
|
||||
public func withDataNoCopy(_ f: (Data) -> Void) {
|
||||
f(Data(bytesNoCopy: self.memory, count: self.length, deallocator: .none))
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: MemoryBuffer, rhs: MemoryBuffer) -> Bool {
|
||||
public static func ==(lhs: MemoryBuffer, rhs: MemoryBuffer) -> Bool {
|
||||
return lhs.length == rhs.length && memcmp(lhs.memory, rhs.memory, lhs.length) == 0
|
||||
}
|
||||
}
|
||||
|
||||
public final class WriteBuffer: MemoryBuffer {
|
||||
|
@ -7,13 +7,6 @@ public struct GroupFeedReadState: Equatable {
|
||||
self.maxReadIndex = maxReadIndex
|
||||
}
|
||||
|
||||
public static func ==(lhs: GroupFeedReadState, rhs: GroupFeedReadState) -> Bool {
|
||||
if lhs.maxReadIndex != rhs.maxReadIndex {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func isIncomingMessageIndexRead(_ index: MessageIndex) -> Bool {
|
||||
return self.maxReadIndex >= index
|
||||
}
|
||||
|
@ -74,10 +74,6 @@ public struct MediaId: Hashable, PostboxCoding, CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: MediaId, rhs: MediaId) -> Bool {
|
||||
return lhs.id == rhs.id && lhs.namespace == rhs.namespace
|
||||
}
|
||||
|
||||
public protocol AssociatedMediaData: class, PostboxCoding {
|
||||
func isEqual(to: AssociatedMediaData) -> Bool
|
||||
}
|
||||
|
@ -74,13 +74,8 @@ public struct MessageId: Hashable, Comparable, CustomStringConvertible {
|
||||
}
|
||||
return array
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: MessageId, rhs: MessageId) -> Bool {
|
||||
return lhs.id == rhs.id && lhs.namespace == rhs.namespace && lhs.peerId == rhs.peerId
|
||||
}
|
||||
|
||||
public func <(lhs: MessageId, rhs: MessageId) -> Bool {
|
||||
public static func <(lhs: MessageId, rhs: MessageId) -> Bool {
|
||||
if lhs.namespace == rhs.namespace {
|
||||
if lhs.id == rhs.id {
|
||||
return lhs.peerId < rhs.peerId
|
||||
@ -90,8 +85,8 @@ public func <(lhs: MessageId, rhs: MessageId) -> Bool {
|
||||
} else {
|
||||
return lhs.namespace < rhs.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct MessageIndex: Comparable, Hashable {
|
||||
public let id: MessageId
|
||||
public let timestamp: Int32
|
||||
@ -159,13 +154,8 @@ public struct MessageIndex: Comparable, Hashable {
|
||||
func withPeerId(_ peerId: PeerId) -> MessageIndex {
|
||||
return MessageIndex(id: MessageId(peerId: peerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
||||
return lhs.id == rhs.id && lhs.timestamp == rhs.timestamp
|
||||
}
|
||||
|
||||
public func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
||||
public static func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
||||
if lhs.timestamp != rhs.timestamp {
|
||||
return lhs.timestamp < rhs.timestamp
|
||||
}
|
||||
@ -175,6 +165,7 @@ public func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
||||
}
|
||||
|
||||
return lhs.id.id < rhs.id.id
|
||||
}
|
||||
}
|
||||
|
||||
public struct ChatListIndex: Comparable, Hashable {
|
||||
@ -186,10 +177,6 @@ public struct ChatListIndex: Comparable, Hashable {
|
||||
self.messageIndex = messageIndex
|
||||
}
|
||||
|
||||
public static func ==(lhs: ChatListIndex, rhs: ChatListIndex) -> Bool {
|
||||
return lhs.pinningIndex == rhs.pinningIndex && lhs.messageIndex == rhs.messageIndex
|
||||
}
|
||||
|
||||
public static func <(lhs: ChatListIndex, rhs: ChatListIndex) -> Bool {
|
||||
if let lhsPinningIndex = lhs.pinningIndex, let rhsPinningIndex = rhs.pinningIndex {
|
||||
if lhsPinningIndex > rhsPinningIndex {
|
||||
@ -415,9 +402,8 @@ public struct MessageForwardInfo: Equatable {
|
||||
public let sourceMessageId: MessageId?
|
||||
public let date: Int32
|
||||
public let authorSignature: String?
|
||||
}
|
||||
|
||||
public func ==(lhs: MessageForwardInfo, rhs: MessageForwardInfo) -> Bool {
|
||||
public static func ==(lhs: MessageForwardInfo, rhs: MessageForwardInfo) -> Bool {
|
||||
if !lhs.author.isEqual(rhs.author) {
|
||||
return false
|
||||
}
|
||||
@ -439,6 +425,7 @@ public func ==(lhs: MessageForwardInfo, rhs: MessageForwardInfo) -> Bool {
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public protocol MessageAttribute: PostboxCoding {
|
||||
@ -458,10 +445,6 @@ public extension MessageAttribute {
|
||||
|
||||
public struct MessageGroupInfo: Equatable {
|
||||
public let stableId: UInt32
|
||||
|
||||
public static func ==(lhs: MessageGroupInfo, rhs: MessageGroupInfo) -> Bool {
|
||||
return lhs.stableId == rhs.stableId
|
||||
}
|
||||
}
|
||||
|
||||
public final class Message {
|
||||
|
@ -20,8 +20,4 @@ public struct MessageHistoryHole: Equatable, CustomStringConvertible {
|
||||
public var description: String {
|
||||
return "MessageHistoryHole(peerId: \(self.maxIndex.id.peerId), min: \(self.min), max: \(self.maxIndex.id.id))"
|
||||
}
|
||||
|
||||
public static func ==(lhs: MessageHistoryHole, rhs: MessageHistoryHole) -> Bool {
|
||||
return lhs.maxIndex == rhs.maxIndex && lhs.min == rhs.min && lhs.tags == rhs.tags
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable {
|
||||
}
|
||||
|
||||
public init(_ buffer: ReadBuffer) {
|
||||
|
||||
var namespace: Int32 = 0
|
||||
var id: Int32 = 0
|
||||
memcpy(&namespace, buffer.memory, 4)
|
||||
@ -74,13 +73,8 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable {
|
||||
buffer.write(&namespace, offset: 0, length: 4);
|
||||
buffer.write(&id, offset: 0, length: 4);
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: PeerId, rhs: PeerId) -> Bool {
|
||||
return lhs.id == rhs.id && lhs.namespace == rhs.namespace
|
||||
}
|
||||
|
||||
public func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
||||
public static func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
||||
if lhs.namespace != rhs.namespace {
|
||||
return lhs.namespace < rhs.namespace
|
||||
}
|
||||
@ -90,6 +84,7 @@ public func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public protocol Peer: class, PostboxCoding {
|
||||
|
@ -4,23 +4,6 @@ public enum PeerIndexNameRepresentation: Equatable {
|
||||
case title(title: String, addressName: String?)
|
||||
case personName(first: String, last: String, addressName: String?, phoneNumber: String?)
|
||||
|
||||
public static func ==(lhs: PeerIndexNameRepresentation, rhs: PeerIndexNameRepresentation) -> Bool {
|
||||
switch lhs {
|
||||
case let .title(lhsTitle, lhsAddressName):
|
||||
if case let .title(rhsTitle, rhsAddressName) = rhs, lhsTitle == rhsTitle, lhsAddressName == rhsAddressName {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .personName(lhsFirst, lhsLast, lhsAddressName, lhsPhoneNumber):
|
||||
if case let .personName(rhsFirst, rhsLast, rhsAddressName, rhsPhoneNumber) = rhs, lhsFirst == rhsFirst, lhsLast == rhsLast, lhsAddressName == rhsAddressName, lhsPhoneNumber == rhsPhoneNumber {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var isEmpty: Bool {
|
||||
switch self {
|
||||
case let .title(title, addressName):
|
||||
|
@ -30,23 +30,6 @@ public enum PeerReadState: Equatable, CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
public static func ==(lhs: PeerReadState, rhs: PeerReadState) -> Bool {
|
||||
switch lhs {
|
||||
case let .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count):
|
||||
if case .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .indexBased(maxIncomingReadIndex, maxOutgoingReadIndex, count):
|
||||
if case .indexBased(maxIncomingReadIndex, maxOutgoingReadIndex, count) = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isIncomingMessageIndexRead(_ index: MessageIndex) -> Bool {
|
||||
switch self {
|
||||
case let .idBased(maxIncomingReadId, _, _, _):
|
||||
|
Loading…
x
Reference in New Issue
Block a user