Skip to content

Commit 4f29f9b

Browse files
author
Isaac
committed
Various improvements
1 parent faa765b commit 4f29f9b

File tree

4 files changed

+41
-32
lines changed

4 files changed

+41
-32
lines changed

submodules/Postbox/Sources/Postbox.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,8 +3014,8 @@ final class PostboxImpl {
30143014

30153015
let endTime = CFAbsoluteTimeGetCurrent()
30163016
let transactionDuration = endTime - startTime
3017-
if transactionDuration > 0.1 {
3018-
postboxLog("Postbox transaction took \(transactionDuration * 1000.0) ms, from: \(file), on:\(line)")
3017+
if transactionDuration > 0.01 {
3018+
postboxLog("Postbox transaction took \(transactionDuration * 1000.0) ms, from: \(file):\(line)")
30193019
}
30203020

30213021
let _ = self.isInTransaction.swap(false)
@@ -3028,15 +3028,15 @@ final class PostboxImpl {
30283028
return (result, updatedTransactionState, updatedMasterClientId)
30293029
}
30303030

3031-
public func transactionSignal<T, E>(userInteractive: Bool = false, _ f: @escaping(Subscriber<T, E>, Transaction) -> Disposable) -> Signal<T, E> {
3031+
public func transactionSignal<T, E>(userInteractive: Bool = false, _ f: @escaping(Subscriber<T, E>, Transaction) -> Disposable, file: String = #file, line: Int = #line) -> Signal<T, E> {
30323032
return Signal { subscriber in
30333033
let disposable = MetaDisposable()
30343034

30353035
let f: () -> Void = {
30363036
self.beginInternalTransaction {
30373037
let (_, updatedTransactionState, updatedMasterClientId) = self.internalTransaction({ transaction in
30383038
disposable.set(f(subscriber, transaction))
3039-
})
3039+
}, file: file, line: line)
30403040

30413041
if updatedTransactionState != nil || updatedMasterClientId != nil {
30423042
//self.pipeNotifier.notify()

submodules/TelegramUI/Components/Chat/ChatInputTextNode/Sources/ChatInputTextNode.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@ public final class ChatInputTextView: ChatInputTextViewImpl, UITextViewDelegate,
10501050
}
10511051

10521052
public var toggleQuoteCollapse: ((NSRange) -> Void)?
1053+
public var onUpdateLayout: (() -> Void)?
10531054

10541055
private let displayInternal: ChatInputTextInternal
10551056
private let measureInternal: ChatInputTextInternal
@@ -1385,6 +1386,8 @@ public final class ChatInputTextView: ChatInputTextViewImpl, UITextViewDelegate,
13851386
for id in removedBlockQuotes {
13861387
self.blockQuotes.removeValue(forKey: id)
13871388
}
1389+
1390+
self.onUpdateLayout?()
13881391
}
13891392

13901393
override public func caretRect(for position: UITextPosition) -> CGRect {

submodules/TelegramUI/Sources/ChatHistoryListNode.swift

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,32 +1721,32 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
17211721
var measure_isFirstTime = true
17221722
let messageViewQueue = Queue.mainQueue()
17231723
let historyViewTransitionDisposable = (combineLatest(queue: messageViewQueue,
1724-
historyViewUpdate |> debug_measureTimeToFirstEvent(label: "historyViewUpdate"),
1725-
self.chatPresentationDataPromise.get(),
1726-
selectedMessages,
1727-
updatingMedia,
1728-
automaticDownloadNetworkType,
1729-
preferredStoryHighQuality,
1730-
animatedEmojiStickers,
1731-
additionalAnimatedEmojiStickers,
1732-
customChannelDiscussionReadState,
1733-
customThreadOutgoingReadState,
1734-
availableReactions,
1735-
availableMessageEffects,
1736-
savedMessageTags,
1737-
defaultReaction,
1738-
accountPeer,
1739-
audioTranscriptionSuggestion,
1740-
promises,
1741-
topicAuthorId,
1742-
translationState,
1743-
maxReadStoryId,
1744-
recommendedChannels,
1745-
audioTranscriptionTrial,
1746-
chatThemes,
1747-
deviceContactsNumbers,
1748-
contentSettings
1749-
) |> 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
1724+
historyViewUpdate |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_historyViewUpdate"),
1725+
self.chatPresentationDataPromise.get() |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_chatPresentationData"),
1726+
selectedMessages |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_selectedMessages"),
1727+
updatingMedia |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_updatingMedia"),
1728+
automaticDownloadNetworkType |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_automaticDownloadNetworkType"),
1729+
preferredStoryHighQuality |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_preferredStoryHighQuality"),
1730+
animatedEmojiStickers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_animatedEmojiStickers"),
1731+
additionalAnimatedEmojiStickers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_additionalAnimatedEmojiStickers"),
1732+
customChannelDiscussionReadState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_customChannelDiscussionReadState"),
1733+
customThreadOutgoingReadState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_customThreadOutgoingReadState"),
1734+
availableReactions |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_availableReactions"),
1735+
availableMessageEffects |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_availableMessageEffects"),
1736+
savedMessageTags |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_savedMessageTags"),
1737+
defaultReaction |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_defaultReaction"),
1738+
accountPeer |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_accountPeer"),
1739+
audioTranscriptionSuggestion |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_audioTranscriptionSuggestion"),
1740+
promises |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_promises"),
1741+
topicAuthorId |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_topicAuthorId"),
1742+
translationState |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_translationState"),
1743+
maxReadStoryId |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_maxReadStoryId"),
1744+
recommendedChannels |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_recommendedChannels"),
1745+
audioTranscriptionTrial |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_audioTranscriptionTrial"),
1746+
chatThemes |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_chatThemes"),
1747+
deviceContactsNumbers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_deviceContactsNumbers"),
1748+
contentSettings |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_contentSettings")
1749+
) |> 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
17501750
let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots, allAdMessages) = promises
17511751

17521752
if measure_isFirstTime {
@@ -2311,8 +2311,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
23112311

23122312
var didSetPresentationData = false
23132313
self.presentationDataDisposable = (combineLatest(queue: .mainQueue(),
2314-
updated,
2315-
appConfiguration
2314+
updated |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_beginPresentationDataManagement_updated"),
2315+
appConfiguration |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_beginPresentationDataManagement_appConfiguration")
23162316
)
23172317
|> deliverOnMainQueue).startStrict(next: { [weak self] presentationData, appConfiguration in
23182318
if let strongSelf = self {

submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,12 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
12141214
self.textInputBackgroundNode.isUserInteractionEnabled = !textInputNode.isUserInteractionEnabled
12151215
//self.textInputBackgroundNode.view.removeGestureRecognizer(self.textInputBackgroundNode.view.gestureRecognizers![0])
12161216

1217+
textInputNode.textView.onUpdateLayout = { [weak self] in
1218+
guard let self else {
1219+
return
1220+
}
1221+
self.updateSpoiler()
1222+
}
12171223
textInputNode.textView.toggleQuoteCollapse = { [weak self] range in
12181224
guard let self else {
12191225
return

0 commit comments

Comments
 (0)