mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Various fixes
This commit is contained in:
parent
b35ede7462
commit
de5d52ea48
@ -46,8 +46,9 @@ public final class ChatMessageItemAssociatedData: Equatable {
|
|||||||
public let alwaysDisplayTranscribeButton: DisplayTranscribeButton
|
public let alwaysDisplayTranscribeButton: DisplayTranscribeButton
|
||||||
public let accountPeer: EnginePeer?
|
public let accountPeer: EnginePeer?
|
||||||
public let topicAuthorId: EnginePeer.Id?
|
public let topicAuthorId: EnginePeer.Id?
|
||||||
|
public let hasBots: Bool
|
||||||
|
|
||||||
public init(automaticDownloadPeerType: MediaAutoDownloadPeerType, automaticDownloadNetworkType: MediaAutoDownloadNetworkType, isRecentActions: Bool = false, subject: ChatControllerSubject? = nil, contactsPeerIds: Set<EnginePeer.Id> = Set(), channelDiscussionGroup: ChannelDiscussionGroupStatus = .unknown, animatedEmojiStickers: [String: [StickerPackItem]] = [:], additionalAnimatedEmojiStickers: [String: [Int: StickerPackItem]] = [:], forcedResourceStatus: FileMediaResourceStatus? = nil, currentlyPlayingMessageId: EngineMessage.Index? = nil, isCopyProtectionEnabled: Bool = false, availableReactions: AvailableReactions?, defaultReaction: MessageReaction.Reaction?, isPremium: Bool, accountPeer: EnginePeer?, forceInlineReactions: Bool = false, alwaysDisplayTranscribeButton: DisplayTranscribeButton = DisplayTranscribeButton(canBeDisplayed: false, displayForNotConsumed: false), topicAuthorId: EnginePeer.Id? = nil) {
|
public init(automaticDownloadPeerType: MediaAutoDownloadPeerType, automaticDownloadNetworkType: MediaAutoDownloadNetworkType, isRecentActions: Bool = false, subject: ChatControllerSubject? = nil, contactsPeerIds: Set<EnginePeer.Id> = Set(), channelDiscussionGroup: ChannelDiscussionGroupStatus = .unknown, animatedEmojiStickers: [String: [StickerPackItem]] = [:], additionalAnimatedEmojiStickers: [String: [Int: StickerPackItem]] = [:], forcedResourceStatus: FileMediaResourceStatus? = nil, currentlyPlayingMessageId: EngineMessage.Index? = nil, isCopyProtectionEnabled: Bool = false, availableReactions: AvailableReactions?, defaultReaction: MessageReaction.Reaction?, isPremium: Bool, accountPeer: EnginePeer?, forceInlineReactions: Bool = false, alwaysDisplayTranscribeButton: DisplayTranscribeButton = DisplayTranscribeButton(canBeDisplayed: false, displayForNotConsumed: false), topicAuthorId: EnginePeer.Id? = nil, hasBots: Bool = false) {
|
||||||
self.automaticDownloadPeerType = automaticDownloadPeerType
|
self.automaticDownloadPeerType = automaticDownloadPeerType
|
||||||
self.automaticDownloadNetworkType = automaticDownloadNetworkType
|
self.automaticDownloadNetworkType = automaticDownloadNetworkType
|
||||||
self.isRecentActions = isRecentActions
|
self.isRecentActions = isRecentActions
|
||||||
@ -66,6 +67,7 @@ public final class ChatMessageItemAssociatedData: Equatable {
|
|||||||
self.forceInlineReactions = forceInlineReactions
|
self.forceInlineReactions = forceInlineReactions
|
||||||
self.topicAuthorId = topicAuthorId
|
self.topicAuthorId = topicAuthorId
|
||||||
self.alwaysDisplayTranscribeButton = alwaysDisplayTranscribeButton
|
self.alwaysDisplayTranscribeButton = alwaysDisplayTranscribeButton
|
||||||
|
self.hasBots = hasBots
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func == (lhs: ChatMessageItemAssociatedData, rhs: ChatMessageItemAssociatedData) -> Bool {
|
public static func == (lhs: ChatMessageItemAssociatedData, rhs: ChatMessageItemAssociatedData) -> Bool {
|
||||||
@ -120,6 +122,9 @@ public final class ChatMessageItemAssociatedData: Equatable {
|
|||||||
if lhs.alwaysDisplayTranscribeButton != rhs.alwaysDisplayTranscribeButton {
|
if lhs.alwaysDisplayTranscribeButton != rhs.alwaysDisplayTranscribeButton {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.hasBots != rhs.hasBots {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1072,8 +1072,9 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
|||||||
if !xOffset.isZero {
|
if !xOffset.isZero {
|
||||||
self.clearButton.layer.animatePosition(from: .zero, to: CGPoint(x: xOffset, y: 0.0), duration: duration, timingFunction: timingFunction, additive: true)
|
self.clearButton.layer.animatePosition(from: .zero, to: CGPoint(x: xOffset, y: 0.0), duration: duration, timingFunction: timingFunction, additive: true)
|
||||||
}
|
}
|
||||||
self.clearButton.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in
|
self.clearButton.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in
|
||||||
self.clearButton.isHidden = true
|
self.clearButton.isHidden = true
|
||||||
|
self.clearButton.layer.removeAllAnimations()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10739,6 +10739,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.chatDisplayNode.historyNode.chatHasBots = updatedChatPresentationInterfaceState.hasBots
|
||||||
|
|
||||||
if let (updatedSearchQuerySuggestionState, updatedSearchQuerySuggestionSignal) = searchQuerySuggestionResultStateForChatInterfacePresentationState(updatedChatPresentationInterfaceState, context: context, currentQuery: self.searchQuerySuggestionState?.0) {
|
if let (updatedSearchQuerySuggestionState, updatedSearchQuerySuggestionSignal) = searchQuerySuggestionResultStateForChatInterfacePresentationState(updatedChatPresentationInterfaceState, context: context, currentQuery: self.searchQuerySuggestionState?.0) {
|
||||||
self.searchQuerySuggestionState?.1.dispose()
|
self.searchQuerySuggestionState?.1.dispose()
|
||||||
var inScope = true
|
var inScope = true
|
||||||
|
@ -316,7 +316,7 @@ private final class ChatHistoryTransactionOpaqueState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func extractAssociatedData(chatLocation: ChatLocation, view: MessageHistoryView, automaticDownloadNetworkType: MediaAutoDownloadNetworkType, animatedEmojiStickers: [String: [StickerPackItem]], additionalAnimatedEmojiStickers: [String: [Int: StickerPackItem]], subject: ChatControllerSubject?, currentlyPlayingMessageId: MessageIndex?, isCopyProtectionEnabled: Bool, availableReactions: AvailableReactions?, defaultReaction: MessageReaction.Reaction?, isPremium: Bool, alwaysDisplayTranscribeButton: ChatMessageItemAssociatedData.DisplayTranscribeButton, accountPeer: EnginePeer?, topicAuthorId: EnginePeer.Id?) -> ChatMessageItemAssociatedData {
|
private func extractAssociatedData(chatLocation: ChatLocation, view: MessageHistoryView, automaticDownloadNetworkType: MediaAutoDownloadNetworkType, animatedEmojiStickers: [String: [StickerPackItem]], additionalAnimatedEmojiStickers: [String: [Int: StickerPackItem]], subject: ChatControllerSubject?, currentlyPlayingMessageId: MessageIndex?, isCopyProtectionEnabled: Bool, availableReactions: AvailableReactions?, defaultReaction: MessageReaction.Reaction?, isPremium: Bool, alwaysDisplayTranscribeButton: ChatMessageItemAssociatedData.DisplayTranscribeButton, accountPeer: EnginePeer?, topicAuthorId: EnginePeer.Id?, hasBots: Bool) -> ChatMessageItemAssociatedData {
|
||||||
var automaticMediaDownloadPeerType: MediaAutoDownloadPeerType = .channel
|
var automaticMediaDownloadPeerType: MediaAutoDownloadPeerType = .channel
|
||||||
var contactsPeerIds: Set<PeerId> = Set()
|
var contactsPeerIds: Set<PeerId> = Set()
|
||||||
var channelDiscussionGroup: ChatMessageItemAssociatedData.ChannelDiscussionGroupStatus = .unknown
|
var channelDiscussionGroup: ChatMessageItemAssociatedData.ChannelDiscussionGroupStatus = .unknown
|
||||||
@ -365,7 +365,7 @@ private func extractAssociatedData(chatLocation: ChatLocation, view: MessageHist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ChatMessageItemAssociatedData(automaticDownloadPeerType: automaticMediaDownloadPeerType, automaticDownloadNetworkType: automaticDownloadNetworkType, isRecentActions: false, subject: subject, contactsPeerIds: contactsPeerIds, channelDiscussionGroup: channelDiscussionGroup, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, accountPeer: accountPeer, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, topicAuthorId: topicAuthorId)
|
return ChatMessageItemAssociatedData(automaticDownloadPeerType: automaticMediaDownloadPeerType, automaticDownloadNetworkType: automaticDownloadNetworkType, isRecentActions: false, subject: subject, contactsPeerIds: contactsPeerIds, channelDiscussionGroup: channelDiscussionGroup, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, accountPeer: accountPeer, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, topicAuthorId: topicAuthorId, hasBots: hasBots)
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension ChatHistoryLocationInput {
|
private extension ChatHistoryLocationInput {
|
||||||
@ -496,6 +496,15 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private let chatHasBotsPromise = ValuePromise<Bool>(false)
|
||||||
|
var chatHasBots: Bool = false {
|
||||||
|
didSet {
|
||||||
|
if self.chatHasBots != oldValue {
|
||||||
|
self.chatHasBotsPromise.set(self.chatHasBots)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private let galleryHiddenMesageAndMediaDisposable = MetaDisposable()
|
private let galleryHiddenMesageAndMediaDisposable = MetaDisposable()
|
||||||
|
|
||||||
private let messageProcessingManager = ChatMessageThrottledProcessingManager()
|
private let messageProcessingManager = ChatMessageThrottledProcessingManager()
|
||||||
@ -1101,7 +1110,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
self.pendingUnpinnedAllMessagesPromise.get(),
|
self.pendingUnpinnedAllMessagesPromise.get(),
|
||||||
self.pendingRemovedMessagesPromise.get(),
|
self.pendingRemovedMessagesPromise.get(),
|
||||||
self.currentlyPlayingMessageIdPromise.get(),
|
self.currentlyPlayingMessageIdPromise.get(),
|
||||||
self.scrollToMessageIdPromise.get()
|
self.scrollToMessageIdPromise.get(),
|
||||||
|
self.chatHasBotsPromise.get()
|
||||||
)
|
)
|
||||||
|
|
||||||
let historyViewTransitionDisposable = combineLatest(queue: messageViewQueue,
|
let historyViewTransitionDisposable = combineLatest(queue: messageViewQueue,
|
||||||
@ -1122,7 +1132,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
topicAuthorId,
|
topicAuthorId,
|
||||||
self.allAdMessagesPromise.get()
|
self.allAdMessagesPromise.get()
|
||||||
).start(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, allAdMessages in
|
).start(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, allAdMessages in
|
||||||
let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId) = promises
|
let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots) = promises
|
||||||
let currentlyPlayingMessageId = currentlyPlayingMessageIdAndType?.0
|
let currentlyPlayingMessageId = currentlyPlayingMessageIdAndType?.0
|
||||||
|
|
||||||
func applyHole() {
|
func applyHole() {
|
||||||
@ -1261,7 +1271,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
displayForNotConsumed: suggestAudioTranscription.1
|
displayForNotConsumed: suggestAudioTranscription.1
|
||||||
)
|
)
|
||||||
|
|
||||||
let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId)
|
let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId, hasBots: chatHasBots)
|
||||||
|
|
||||||
let filteredEntries = chatHistoryEntriesForView(
|
let filteredEntries = chatHistoryEntriesForView(
|
||||||
location: chatLocation,
|
location: chatLocation,
|
||||||
|
@ -261,7 +261,6 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var entities: [MessageTextEntity]?
|
var entities: [MessageTextEntity]?
|
||||||
|
|
||||||
var updatedCachedChatMessageText: CachedChatMessageText?
|
var updatedCachedChatMessageText: CachedChatMessageText?
|
||||||
if let cached = currentCachedChatMessageText, cached.matches(text: rawText, inputEntities: messageEntities) {
|
if let cached = currentCachedChatMessageText, cached.matches(text: rawText, inputEntities: messageEntities) {
|
||||||
entities = cached.entities
|
entities = cached.entities
|
||||||
@ -301,6 +300,12 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !item.associatedData.hasBots {
|
||||||
|
messageEntities = messageEntities?.filter { $0.type != .BotCommand }
|
||||||
|
entities = entities?.filter { $0.type != .BotCommand }
|
||||||
|
}
|
||||||
|
|
||||||
updatedCachedChatMessageText = CachedChatMessageText(text: rawText, inputEntities: messageEntities, entities: entities)
|
updatedCachedChatMessageText = CachedChatMessageText(text: rawText, inputEntities: messageEntities, entities: entities)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user