mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
faa765b601
commit
4f29f9b1de
@ -3014,8 +3014,8 @@ final class PostboxImpl {
|
||||
|
||||
let endTime = CFAbsoluteTimeGetCurrent()
|
||||
let transactionDuration = endTime - startTime
|
||||
if transactionDuration > 0.1 {
|
||||
postboxLog("Postbox transaction took \(transactionDuration * 1000.0) ms, from: \(file), on:\(line)")
|
||||
if transactionDuration > 0.01 {
|
||||
postboxLog("Postbox transaction took \(transactionDuration * 1000.0) ms, from: \(file):\(line)")
|
||||
}
|
||||
|
||||
let _ = self.isInTransaction.swap(false)
|
||||
@ -3028,7 +3028,7 @@ final class PostboxImpl {
|
||||
return (result, updatedTransactionState, updatedMasterClientId)
|
||||
}
|
||||
|
||||
public func transactionSignal<T, E>(userInteractive: Bool = false, _ f: @escaping(Subscriber<T, E>, Transaction) -> Disposable) -> Signal<T, E> {
|
||||
public func transactionSignal<T, E>(userInteractive: Bool = false, _ f: @escaping(Subscriber<T, E>, Transaction) -> Disposable, file: String = #file, line: Int = #line) -> Signal<T, E> {
|
||||
return Signal { subscriber in
|
||||
let disposable = MetaDisposable()
|
||||
|
||||
@ -3036,7 +3036,7 @@ final class PostboxImpl {
|
||||
self.beginInternalTransaction {
|
||||
let (_, updatedTransactionState, updatedMasterClientId) = self.internalTransaction({ transaction in
|
||||
disposable.set(f(subscriber, transaction))
|
||||
})
|
||||
}, file: file, line: line)
|
||||
|
||||
if updatedTransactionState != nil || updatedMasterClientId != nil {
|
||||
//self.pipeNotifier.notify()
|
||||
|
@ -1050,6 +1050,7 @@ public final class ChatInputTextView: ChatInputTextViewImpl, UITextViewDelegate,
|
||||
}
|
||||
|
||||
public var toggleQuoteCollapse: ((NSRange) -> Void)?
|
||||
public var onUpdateLayout: (() -> Void)?
|
||||
|
||||
private let displayInternal: ChatInputTextInternal
|
||||
private let measureInternal: ChatInputTextInternal
|
||||
@ -1385,6 +1386,8 @@ public final class ChatInputTextView: ChatInputTextViewImpl, UITextViewDelegate,
|
||||
for id in removedBlockQuotes {
|
||||
self.blockQuotes.removeValue(forKey: id)
|
||||
}
|
||||
|
||||
self.onUpdateLayout?()
|
||||
}
|
||||
|
||||
override public func caretRect(for position: UITextPosition) -> CGRect {
|
||||
|
@ -1721,32 +1721,32 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
|
||||
var measure_isFirstTime = true
|
||||
let messageViewQueue = Queue.mainQueue()
|
||||
let historyViewTransitionDisposable = (combineLatest(queue: messageViewQueue,
|
||||
historyViewUpdate |> debug_measureTimeToFirstEvent(label: "historyViewUpdate"),
|
||||
self.chatPresentationDataPromise.get(),
|
||||
selectedMessages,
|
||||
updatingMedia,
|
||||
automaticDownloadNetworkType,
|
||||
preferredStoryHighQuality,
|
||||
animatedEmojiStickers,
|
||||
additionalAnimatedEmojiStickers,
|
||||
customChannelDiscussionReadState,
|
||||
customThreadOutgoingReadState,
|
||||
availableReactions,
|
||||
availableMessageEffects,
|
||||
savedMessageTags,
|
||||
defaultReaction,
|
||||
accountPeer,
|
||||
audioTranscriptionSuggestion,
|
||||
promises,
|
||||
topicAuthorId,
|
||||
translationState,
|
||||
maxReadStoryId,
|
||||
recommendedChannels,
|
||||
audioTranscriptionTrial,
|
||||
chatThemes,
|
||||
deviceContactsNumbers,
|
||||
contentSettings
|
||||
) |> debug_measureTimeToFirstEvent(label: "firstChatHistoryTransition")).startStrict(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, preferredStoryHighQuality, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, availableMessageEffects, savedMessageTags, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, translationState, maxReadStoryId, recommendedChannels, audioTranscriptionTrial, chatThemes, deviceContactsNumbers, contentSettings in
|
||||
historyViewUpdate |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_historyViewUpdate"),
|
||||
self.chatPresentationDataPromise.get() |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_chatPresentationData"),
|
||||
selectedMessages |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_selectedMessages"),
|
||||
updatingMedia |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_updatingMedia"),
|
||||
automaticDownloadNetworkType |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_automaticDownloadNetworkType"),
|
||||
preferredStoryHighQuality |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_preferredStoryHighQuality"),
|
||||
animatedEmojiStickers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_animatedEmojiStickers"),
|
||||
additionalAnimatedEmojiStickers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_additionalAnimatedEmojiStickers"),
|
||||
customChannelDiscussionReadState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_customChannelDiscussionReadState"),
|
||||
customThreadOutgoingReadState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_customThreadOutgoingReadState"),
|
||||
availableReactions |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_availableReactions"),
|
||||
availableMessageEffects |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_availableMessageEffects"),
|
||||
savedMessageTags |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_savedMessageTags"),
|
||||
defaultReaction |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_defaultReaction"),
|
||||
accountPeer |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_accountPeer"),
|
||||
audioTranscriptionSuggestion |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_audioTranscriptionSuggestion"),
|
||||
promises |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_promises"),
|
||||
topicAuthorId |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_topicAuthorId"),
|
||||
translationState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_translationState"),
|
||||
maxReadStoryId |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_maxReadStoryId"),
|
||||
recommendedChannels |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_recommendedChannels"),
|
||||
audioTranscriptionTrial |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_audioTranscriptionTrial"),
|
||||
chatThemes |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_chatThemes"),
|
||||
deviceContactsNumbers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_deviceContactsNumbers"),
|
||||
contentSettings |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_contentSettings")
|
||||
) |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_firstChatHistoryTransition")).startStrict(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, preferredStoryHighQuality, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, availableMessageEffects, savedMessageTags, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, translationState, maxReadStoryId, recommendedChannels, audioTranscriptionTrial, chatThemes, deviceContactsNumbers, contentSettings in
|
||||
let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots, allAdMessages) = promises
|
||||
|
||||
if measure_isFirstTime {
|
||||
@ -2311,8 +2311,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
|
||||
|
||||
var didSetPresentationData = false
|
||||
self.presentationDataDisposable = (combineLatest(queue: .mainQueue(),
|
||||
updated,
|
||||
appConfiguration
|
||||
updated |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_beginPresentationDataManagement_updated"),
|
||||
appConfiguration |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_beginPresentationDataManagement_appConfiguration")
|
||||
)
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] presentationData, appConfiguration in
|
||||
if let strongSelf = self {
|
||||
|
@ -1214,6 +1214,12 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
||||
self.textInputBackgroundNode.isUserInteractionEnabled = !textInputNode.isUserInteractionEnabled
|
||||
//self.textInputBackgroundNode.view.removeGestureRecognizer(self.textInputBackgroundNode.view.gestureRecognizers![0])
|
||||
|
||||
textInputNode.textView.onUpdateLayout = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.updateSpoiler()
|
||||
}
|
||||
textInputNode.textView.toggleQuoteCollapse = { [weak self] range in
|
||||
guard let self else {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user