mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 19:50:47 +00:00
Merge commit '3a090ec7b90a3a3d168e5a034a441d1445d6533d'
This commit is contained in:
commit
cfe11c8a8e
@ -15,6 +15,19 @@ public final class ChatMessageItemAssociatedData: Equatable {
|
|||||||
case known(EnginePeer.Id?)
|
case known(EnginePeer.Id?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct DisplayTranscribeButton: Equatable {
|
||||||
|
public let canBeDisplayed: Bool
|
||||||
|
public let displayForNotConsumed: Bool
|
||||||
|
|
||||||
|
public init(
|
||||||
|
canBeDisplayed: Bool,
|
||||||
|
displayForNotConsumed: Bool
|
||||||
|
) {
|
||||||
|
self.canBeDisplayed = canBeDisplayed
|
||||||
|
self.displayForNotConsumed = displayForNotConsumed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public let automaticDownloadPeerType: MediaAutoDownloadPeerType
|
public let automaticDownloadPeerType: MediaAutoDownloadPeerType
|
||||||
public let automaticDownloadNetworkType: MediaAutoDownloadNetworkType
|
public let automaticDownloadNetworkType: MediaAutoDownloadNetworkType
|
||||||
public let isRecentActions: Bool
|
public let isRecentActions: Bool
|
||||||
@ -30,11 +43,11 @@ public final class ChatMessageItemAssociatedData: Equatable {
|
|||||||
public let defaultReaction: MessageReaction.Reaction?
|
public let defaultReaction: MessageReaction.Reaction?
|
||||||
public let isPremium: Bool
|
public let isPremium: Bool
|
||||||
public let forceInlineReactions: Bool
|
public let forceInlineReactions: Bool
|
||||||
public let alwaysDisplayTranscribeButton: Bool
|
public let alwaysDisplayTranscribeButton: DisplayTranscribeButton
|
||||||
public let accountPeer: EnginePeer?
|
public let accountPeer: EnginePeer?
|
||||||
public let topicAuthorId: EnginePeer.Id?
|
public let topicAuthorId: EnginePeer.Id?
|
||||||
|
|
||||||
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: Bool = 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) {
|
||||||
self.automaticDownloadPeerType = automaticDownloadPeerType
|
self.automaticDownloadPeerType = automaticDownloadPeerType
|
||||||
self.automaticDownloadNetworkType = automaticDownloadNetworkType
|
self.automaticDownloadNetworkType = automaticDownloadNetworkType
|
||||||
self.isRecentActions = isRecentActions
|
self.isRecentActions = isRecentActions
|
||||||
|
@ -3069,6 +3069,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
|
|
||||||
func sendCurrentMessage(silentPosting: Bool? = nil, scheduleTime: Int32? = nil, completion: @escaping () -> Void = {}) {
|
func sendCurrentMessage(silentPosting: Bool? = nil, scheduleTime: Int32? = nil, completion: @escaping () -> Void = {}) {
|
||||||
if let textInputPanelNode = self.inputPanelNode as? ChatTextInputPanelNode {
|
if let textInputPanelNode = self.inputPanelNode as? ChatTextInputPanelNode {
|
||||||
|
self.historyNode.justSentTextMessage = true
|
||||||
|
|
||||||
if let textInputNode = textInputPanelNode.textInputNode, textInputNode.isFirstResponder() {
|
if let textInputNode = textInputPanelNode.textInputNode, textInputNode.isFirstResponder() {
|
||||||
Keyboard.applyAutocorrection(textView: textInputNode.textView)
|
Keyboard.applyAutocorrection(textView: textInputNode.textView)
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,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: Bool, 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?) -> 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
|
||||||
@ -1220,7 +1220,12 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
isPremium = true
|
isPremium = true
|
||||||
}
|
}
|
||||||
|
|
||||||
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: suggestAudioTranscription.0 < 2, accountPeer: accountPeer, topicAuthorId: topicAuthorId)
|
let alwaysDisplayTranscribeButton = ChatMessageItemAssociatedData.DisplayTranscribeButton(
|
||||||
|
canBeDisplayed: suggestAudioTranscription.0 < 2,
|
||||||
|
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 filteredEntries = chatHistoryEntriesForView(
|
let filteredEntries = chatHistoryEntriesForView(
|
||||||
location: chatLocation,
|
location: chatLocation,
|
||||||
|
@ -676,10 +676,10 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||||||
if arguments.message.id.peerId.namespace != Namespaces.Peer.SecretChat {
|
if arguments.message.id.peerId.namespace != Namespaces.Peer.SecretChat {
|
||||||
if arguments.associatedData.isPremium {
|
if arguments.associatedData.isPremium {
|
||||||
displayTranscribe = true
|
displayTranscribe = true
|
||||||
} else if arguments.associatedData.alwaysDisplayTranscribeButton {
|
} else if arguments.associatedData.alwaysDisplayTranscribeButton.canBeDisplayed {
|
||||||
if audioDuration >= 60 {
|
if audioDuration >= 60 {
|
||||||
displayTranscribe = true
|
displayTranscribe = true
|
||||||
} else if isConsumed == false {
|
} else if arguments.incoming && isConsumed == false && arguments.associatedData.alwaysDisplayTranscribeButton.displayForNotConsumed {
|
||||||
displayTranscribe = true
|
displayTranscribe = true
|
||||||
} else {
|
} else {
|
||||||
displayTranscribe = false
|
displayTranscribe = false
|
||||||
|
@ -735,8 +735,12 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
if item.message.id.peerId.namespace != Namespaces.Peer.SecretChat && statusDisplayType == .free {
|
if item.message.id.peerId.namespace != Namespaces.Peer.SecretChat && statusDisplayType == .free {
|
||||||
if item.associatedData.isPremium {
|
if item.associatedData.isPremium {
|
||||||
displayTranscribe = true
|
displayTranscribe = true
|
||||||
} else if item.associatedData.alwaysDisplayTranscribeButton {
|
} else if item.associatedData.alwaysDisplayTranscribeButton.canBeDisplayed {
|
||||||
displayTranscribe = true
|
if incoming && notConsumed && item.associatedData.alwaysDisplayTranscribeButton.displayForNotConsumed {
|
||||||
|
displayTranscribe = true
|
||||||
|
} else {
|
||||||
|
displayTranscribe = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
displayTranscribe = false
|
displayTranscribe = false
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user