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