Update API

This commit is contained in:
Ilya Laktyushin
2023-11-09 02:15:50 +04:00
parent 57e0533a8a
commit 145c674185
8 changed files with 194 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ func chatHistoryEntriesForView(
}
var joinMessage: Message?
if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn {
if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn {
joinMessage = Message(
stableId: UInt32.max - 1000,
stableVersion: 0,
@@ -80,6 +80,32 @@ func chatHistoryEntriesForView(
associatedThreadInfo: nil,
associatedStories: [:]
)
} else if let peer = channelPeer as? TelegramChannel, case .broadcast = peer.info, case .member = peer.participationStatus {
joinMessage = Message(
stableId: UInt32.max - 1000,
stableVersion: 0,
id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Local, id: 0),
globallyUniqueId: nil,
groupingKey: nil,
groupInfo: nil,
threadId: nil,
timestamp: peer.creationDate,
flags: [.Incoming],
tags: [],
globalTags: [],
localTags: [],
forwardInfo: nil,
author: channelPeer,
text: "",
attributes: [],
media: [TelegramMediaAction(action: .joinedChannel)],
peers: SimpleDictionary<PeerId, Peer>(),
associatedMessages: SimpleDictionary<MessageId, Message>(),
associatedMessageIds: [],
associatedMedia: [:],
associatedThreadInfo: nil,
associatedStories: [:]
)
}
var existingGroupStableIds: [UInt32] = []