mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various fixes
This commit is contained in:
@@ -732,6 +732,15 @@ public enum ChatControllerSubject: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var isService: Bool {
|
||||||
|
switch self {
|
||||||
|
case .message:
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChatControllerPresentationMode: Equatable {
|
public enum ChatControllerPresentationMode: Equatable {
|
||||||
|
|||||||
@@ -54,58 +54,62 @@ func chatHistoryEntriesForView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var joinMessage: Message?
|
var joinMessage: Message?
|
||||||
if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn {
|
if (associatedData.subject?.isService ?? false) {
|
||||||
joinMessage = Message(
|
|
||||||
stableId: UInt32.max - 1000,
|
} else {
|
||||||
stableVersion: 0,
|
if case let .peer(peerId) = location, case let cachedData = cachedData as? CachedChannelData, let invitedOn = cachedData?.invitedOn {
|
||||||
id: MessageId(peerId: peerId, namespace: Namespaces.Message.Local, id: 0),
|
joinMessage = Message(
|
||||||
globallyUniqueId: nil,
|
stableId: UInt32.max - 1000,
|
||||||
groupingKey: nil,
|
stableVersion: 0,
|
||||||
groupInfo: nil,
|
id: MessageId(peerId: peerId, namespace: Namespaces.Message.Local, id: 0),
|
||||||
threadId: nil,
|
globallyUniqueId: nil,
|
||||||
timestamp: invitedOn,
|
groupingKey: nil,
|
||||||
flags: [.Incoming],
|
groupInfo: nil,
|
||||||
tags: [],
|
threadId: nil,
|
||||||
globalTags: [],
|
timestamp: invitedOn,
|
||||||
localTags: [],
|
flags: [.Incoming],
|
||||||
forwardInfo: nil,
|
tags: [],
|
||||||
author: channelPeer,
|
globalTags: [],
|
||||||
text: "",
|
localTags: [],
|
||||||
attributes: [],
|
forwardInfo: nil,
|
||||||
media: [TelegramMediaAction(action: .joinedByRequest)],
|
author: channelPeer,
|
||||||
peers: SimpleDictionary<PeerId, Peer>(),
|
text: "",
|
||||||
associatedMessages: SimpleDictionary<MessageId, Message>(),
|
attributes: [],
|
||||||
associatedMessageIds: [],
|
media: [TelegramMediaAction(action: .joinedByRequest)],
|
||||||
associatedMedia: [:],
|
peers: SimpleDictionary<PeerId, Peer>(),
|
||||||
associatedThreadInfo: nil,
|
associatedMessages: SimpleDictionary<MessageId, Message>(),
|
||||||
associatedStories: [:]
|
associatedMessageIds: [],
|
||||||
)
|
associatedMedia: [:],
|
||||||
} else if let peer = channelPeer as? TelegramChannel, case .broadcast = peer.info, case .member = peer.participationStatus {
|
associatedThreadInfo: nil,
|
||||||
joinMessage = Message(
|
associatedStories: [:]
|
||||||
stableId: UInt32.max - 1000,
|
)
|
||||||
stableVersion: 0,
|
} else if let peer = channelPeer as? TelegramChannel, case .broadcast = peer.info, case .member = peer.participationStatus {
|
||||||
id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Local, id: 0),
|
joinMessage = Message(
|
||||||
globallyUniqueId: nil,
|
stableId: UInt32.max - 1000,
|
||||||
groupingKey: nil,
|
stableVersion: 0,
|
||||||
groupInfo: nil,
|
id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Local, id: 0),
|
||||||
threadId: nil,
|
globallyUniqueId: nil,
|
||||||
timestamp: peer.creationDate,
|
groupingKey: nil,
|
||||||
flags: [.Incoming],
|
groupInfo: nil,
|
||||||
tags: [],
|
threadId: nil,
|
||||||
globalTags: [],
|
timestamp: peer.creationDate,
|
||||||
localTags: [],
|
flags: [.Incoming],
|
||||||
forwardInfo: nil,
|
tags: [],
|
||||||
author: channelPeer,
|
globalTags: [],
|
||||||
text: "",
|
localTags: [],
|
||||||
attributes: [],
|
forwardInfo: nil,
|
||||||
media: [TelegramMediaAction(action: .joinedChannel)],
|
author: channelPeer,
|
||||||
peers: SimpleDictionary<PeerId, Peer>(),
|
text: "",
|
||||||
associatedMessages: SimpleDictionary<MessageId, Message>(),
|
attributes: [],
|
||||||
associatedMessageIds: [],
|
media: [TelegramMediaAction(action: .joinedChannel)],
|
||||||
associatedMedia: [:],
|
peers: SimpleDictionary<PeerId, Peer>(),
|
||||||
associatedThreadInfo: nil,
|
associatedMessages: SimpleDictionary<MessageId, Message>(),
|
||||||
associatedStories: [:]
|
associatedMessageIds: [],
|
||||||
)
|
associatedMedia: [:],
|
||||||
|
associatedThreadInfo: nil,
|
||||||
|
associatedStories: [:]
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var existingGroupStableIds: [UInt32] = []
|
var existingGroupStableIds: [UInt32] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user