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>
|
<key>PostboxMac.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>5</integer>
|
<integer>4</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>PostboxTests.xcscheme</key>
|
<key>PostboxTests.xcscheme</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -14,12 +14,8 @@ public struct ChatListHole: Hashable, CustomStringConvertible {
|
|||||||
public var hashValue: Int {
|
public var hashValue: Int {
|
||||||
return self.index.hashValue
|
return self.index.hashValue
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func ==(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
public static func <(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
||||||
return lhs.index == rhs.index
|
|
||||||
}
|
|
||||||
|
|
||||||
public func <(lhs: ChatListHole, rhs: ChatListHole) -> Bool {
|
|
||||||
return lhs.index < rhs.index
|
return lhs.index < rhs.index
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -107,11 +107,11 @@ public class MemoryBuffer: Equatable, CustomStringConvertible {
|
|||||||
public func withDataNoCopy(_ f: (Data) -> Void) {
|
public func withDataNoCopy(_ f: (Data) -> Void) {
|
||||||
f(Data(bytesNoCopy: self.memory, count: self.length, deallocator: .none))
|
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
|
return lhs.length == rhs.length && memcmp(lhs.memory, rhs.memory, lhs.length) == 0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final class WriteBuffer: MemoryBuffer {
|
public final class WriteBuffer: MemoryBuffer {
|
||||||
public var offset = 0
|
public var offset = 0
|
||||||
|
@ -7,13 +7,6 @@ public struct GroupFeedReadState: Equatable {
|
|||||||
self.maxReadIndex = maxReadIndex
|
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 {
|
func isIncomingMessageIndexRead(_ index: MessageIndex) -> Bool {
|
||||||
return self.maxReadIndex >= index
|
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 {
|
public protocol AssociatedMediaData: class, PostboxCoding {
|
||||||
func isEqual(to: AssociatedMediaData) -> Bool
|
func isEqual(to: AssociatedMediaData) -> Bool
|
||||||
}
|
}
|
||||||
|
@ -74,13 +74,8 @@ public struct MessageId: Hashable, Comparable, CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func ==(lhs: MessageId, rhs: MessageId) -> Bool {
|
public static 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 {
|
|
||||||
if lhs.namespace == rhs.namespace {
|
if lhs.namespace == rhs.namespace {
|
||||||
if lhs.id == rhs.id {
|
if lhs.id == rhs.id {
|
||||||
return lhs.peerId < rhs.peerId
|
return lhs.peerId < rhs.peerId
|
||||||
@ -91,7 +86,7 @@ public func <(lhs: MessageId, rhs: MessageId) -> Bool {
|
|||||||
return lhs.namespace < rhs.namespace
|
return lhs.namespace < rhs.namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public struct MessageIndex: Comparable, Hashable {
|
public struct MessageIndex: Comparable, Hashable {
|
||||||
public let id: MessageId
|
public let id: MessageId
|
||||||
public let timestamp: Int32
|
public let timestamp: Int32
|
||||||
@ -159,13 +154,8 @@ public struct MessageIndex: Comparable, Hashable {
|
|||||||
func withPeerId(_ peerId: PeerId) -> MessageIndex {
|
func withPeerId(_ peerId: PeerId) -> MessageIndex {
|
||||||
return MessageIndex(id: MessageId(peerId: peerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: peerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func ==(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
public static func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
||||||
return lhs.id == rhs.id && lhs.timestamp == rhs.timestamp
|
|
||||||
}
|
|
||||||
|
|
||||||
public func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
|
||||||
if lhs.timestamp != rhs.timestamp {
|
if lhs.timestamp != rhs.timestamp {
|
||||||
return lhs.timestamp < rhs.timestamp
|
return lhs.timestamp < rhs.timestamp
|
||||||
}
|
}
|
||||||
@ -176,6 +166,7 @@ public func <(lhs: MessageIndex, rhs: MessageIndex) -> Bool {
|
|||||||
|
|
||||||
return lhs.id.id < rhs.id.id
|
return lhs.id.id < rhs.id.id
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public struct ChatListIndex: Comparable, Hashable {
|
public struct ChatListIndex: Comparable, Hashable {
|
||||||
public let pinningIndex: UInt16?
|
public let pinningIndex: UInt16?
|
||||||
@ -186,10 +177,6 @@ public struct ChatListIndex: Comparable, Hashable {
|
|||||||
self.messageIndex = messageIndex
|
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 {
|
public static func <(lhs: ChatListIndex, rhs: ChatListIndex) -> Bool {
|
||||||
if let lhsPinningIndex = lhs.pinningIndex, let rhsPinningIndex = rhs.pinningIndex {
|
if let lhsPinningIndex = lhs.pinningIndex, let rhsPinningIndex = rhs.pinningIndex {
|
||||||
if lhsPinningIndex > rhsPinningIndex {
|
if lhsPinningIndex > rhsPinningIndex {
|
||||||
@ -415,9 +402,8 @@ public struct MessageForwardInfo: Equatable {
|
|||||||
public let sourceMessageId: MessageId?
|
public let sourceMessageId: MessageId?
|
||||||
public let date: Int32
|
public let date: Int32
|
||||||
public let authorSignature: String?
|
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) {
|
if !lhs.author.isEqual(rhs.author) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -440,6 +426,7 @@ public func ==(lhs: MessageForwardInfo, rhs: MessageForwardInfo) -> Bool {
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public protocol MessageAttribute: PostboxCoding {
|
public protocol MessageAttribute: PostboxCoding {
|
||||||
var associatedPeerIds: [PeerId] { get }
|
var associatedPeerIds: [PeerId] { get }
|
||||||
@ -458,10 +445,6 @@ public extension MessageAttribute {
|
|||||||
|
|
||||||
public struct MessageGroupInfo: Equatable {
|
public struct MessageGroupInfo: Equatable {
|
||||||
public let stableId: UInt32
|
public let stableId: UInt32
|
||||||
|
|
||||||
public static func ==(lhs: MessageGroupInfo, rhs: MessageGroupInfo) -> Bool {
|
|
||||||
return lhs.stableId == rhs.stableId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class Message {
|
public final class Message {
|
||||||
|
@ -20,8 +20,4 @@ public struct MessageHistoryHole: Equatable, CustomStringConvertible {
|
|||||||
public var description: String {
|
public var description: String {
|
||||||
return "MessageHistoryHole(peerId: \(self.maxIndex.id.peerId), min: \(self.min), max: \(self.maxIndex.id.id))"
|
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) {
|
public init(_ buffer: ReadBuffer) {
|
||||||
|
|
||||||
var namespace: Int32 = 0
|
var namespace: Int32 = 0
|
||||||
var id: Int32 = 0
|
var id: Int32 = 0
|
||||||
memcpy(&namespace, buffer.memory, 4)
|
memcpy(&namespace, buffer.memory, 4)
|
||||||
@ -74,13 +73,8 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable {
|
|||||||
buffer.write(&namespace, offset: 0, length: 4);
|
buffer.write(&namespace, offset: 0, length: 4);
|
||||||
buffer.write(&id, offset: 0, length: 4);
|
buffer.write(&id, offset: 0, length: 4);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func ==(lhs: PeerId, rhs: PeerId) -> Bool {
|
public static func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
||||||
return lhs.id == rhs.id && lhs.namespace == rhs.namespace
|
|
||||||
}
|
|
||||||
|
|
||||||
public func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
|
||||||
if lhs.namespace != rhs.namespace {
|
if lhs.namespace != rhs.namespace {
|
||||||
return lhs.namespace < rhs.namespace
|
return lhs.namespace < rhs.namespace
|
||||||
}
|
}
|
||||||
@ -91,6 +85,7 @@ public func <(lhs: PeerId, rhs: PeerId) -> Bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public protocol Peer: class, PostboxCoding {
|
public protocol Peer: class, PostboxCoding {
|
||||||
var id: PeerId { get }
|
var id: PeerId { get }
|
||||||
|
@ -4,23 +4,6 @@ public enum PeerIndexNameRepresentation: Equatable {
|
|||||||
case title(title: String, addressName: String?)
|
case title(title: String, addressName: String?)
|
||||||
case personName(first: String, last: String, addressName: String?, phoneNumber: 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 {
|
public var isEmpty: Bool {
|
||||||
switch self {
|
switch self {
|
||||||
case let .title(title, addressName):
|
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 {
|
func isIncomingMessageIndexRead(_ index: MessageIndex) -> Bool {
|
||||||
switch self {
|
switch self {
|
||||||
case let .idBased(maxIncomingReadId, _, _, _):
|
case let .idBased(maxIncomingReadId, _, _, _):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user