mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[WIP] Topics
This commit is contained in:
@@ -50,6 +50,7 @@ public struct Namespaces {
|
||||
public static let CloudEmojiPacks: Int32 = 8
|
||||
public static let CloudEmojiGenericAnimations: Int32 = 9
|
||||
public static let CloudIconStatusEmoji: Int32 = 10
|
||||
public static let CloudIconTopicEmoji: Int32 = 11
|
||||
}
|
||||
|
||||
public struct OrderedItemList {
|
||||
|
||||
@@ -83,10 +83,16 @@ class InternalChatInterfaceState: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
func _internal_updateChatInputState(transaction: Transaction, peerId: PeerId, inputState: SynchronizeableChatInputState?) {
|
||||
func _internal_updateChatInputState(transaction: Transaction, peerId: PeerId, threadId: Int64?, inputState: SynchronizeableChatInputState?) {
|
||||
var previousState: InternalChatInterfaceState?
|
||||
if let peerChatInterfaceState = transaction.getPeerChatInterfaceState(peerId), let data = peerChatInterfaceState.data {
|
||||
previousState = (try? AdaptedPostboxDecoder().decode(InternalChatInterfaceState.self, from: data))
|
||||
if let threadId = threadId {
|
||||
if let peerChatInterfaceState = transaction.getPeerChatThreadInterfaceState(peerId, threadId: threadId), let data = peerChatInterfaceState.data {
|
||||
previousState = (try? AdaptedPostboxDecoder().decode(InternalChatInterfaceState.self, from: data))
|
||||
}
|
||||
} else {
|
||||
if let peerChatInterfaceState = transaction.getPeerChatInterfaceState(peerId), let data = peerChatInterfaceState.data {
|
||||
previousState = (try? AdaptedPostboxDecoder().decode(InternalChatInterfaceState.self, from: data))
|
||||
}
|
||||
}
|
||||
|
||||
if let updatedStateData = try? AdaptedPostboxEncoder().encode(InternalChatInterfaceState(
|
||||
@@ -100,6 +106,10 @@ func _internal_updateChatInputState(transaction: Transaction, peerId: PeerId, in
|
||||
associatedMessageIds: (inputState?.replyToMessageId).flatMap({ [$0] }) ?? [],
|
||||
data: updatedStateData
|
||||
)
|
||||
transaction.setPeerChatInterfaceState(peerId, state: storedState)
|
||||
if let threadId = threadId {
|
||||
transaction.setPeerChatThreadInterfaceState(peerId, threadId: threadId, state: storedState)
|
||||
} else {
|
||||
transaction.setPeerChatInterfaceState(peerId, state: storedState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable, Codable {
|
||||
case premiumGifts
|
||||
case emojiGenericAnimations
|
||||
case iconStatusEmoji
|
||||
case iconTopicEmoji
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
switch decoder.decodeInt32ForKey("r", orElse: 0) {
|
||||
@@ -84,7 +85,7 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable, Codable {
|
||||
encoder.encodeInt32(4, forKey: "r")
|
||||
case .premiumGifts:
|
||||
encoder.encodeInt32(5, forKey: "r")
|
||||
case .emojiGenericAnimations, .iconStatusEmoji:
|
||||
case .emojiGenericAnimations, .iconStatusEmoji, .iconTopicEmoji:
|
||||
preconditionFailure()
|
||||
}
|
||||
}
|
||||
@@ -109,7 +110,7 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable, Codable {
|
||||
try container.encode(4 as Int32, forKey: "r")
|
||||
case .premiumGifts:
|
||||
try container.encode(5 as Int32, forKey: "r")
|
||||
case .emojiGenericAnimations, .iconStatusEmoji:
|
||||
case .emojiGenericAnimations, .iconStatusEmoji, .iconTopicEmoji:
|
||||
preconditionFailure()
|
||||
}
|
||||
}
|
||||
@@ -164,6 +165,12 @@ public enum StickerPackReference: PostboxCoding, Hashable, Equatable, Codable {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .iconTopicEmoji:
|
||||
if case .iconTopicEmoji = rhs {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user