From e6552c79ecc3acfe4cb32c3b86990bedcb003fb6 Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Tue, 1 Feb 2022 09:24:10 -0800 Subject: [PATCH] Fix UI delay when sending a reply in chat. The UI updates (including adding a new message to conversation) were being blocked for 1 second because of the animated dismissal of message quote panel attached to the input field. The fix is to block UI updates just for the duration of keyboard animations. --- .../ConversationViewController+Delegates.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+Delegates.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+Delegates.swift index 784728c1f5..5cfef8c210 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+Delegates.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+Delegates.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -377,8 +377,7 @@ extension ConversationViewController: InputAccessoryViewPlaceholderDelegate { // loads from landing during the keyboard animation. // It isn't safe to block loads for long, so we cap // how long they will be blocked for. - let keyboardAnimationBlockLoadInterval: TimeInterval = kSecondInterval * 1.0 - let animationCompletionDate = Date().addingTimeInterval(keyboardAnimationBlockLoadInterval) + let animationCompletionDate = Date().addingTimeInterval(duration) let lastKeyboardAnimationDate = Date().addingTimeInterval(-1.0) if viewState.lastKeyboardAnimationDate == nil || viewState.lastKeyboardAnimationDate?.isBefore(lastKeyboardAnimationDate) == true {