From e87e918e6e3c37f0464cd8224c52c28410b38f04 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 17 Apr 2024 22:22:57 +0400 Subject: [PATCH] Authorization improvements --- .../AuthorizationSequenceCodeEntryControllerNode.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift index d56702e7e6..e2abc23356 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceCodeEntryControllerNode.swift @@ -359,12 +359,14 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF if let text = UIPasteboard.general.string, !text.isEmpty { if checkValidity(text: text) { self.textField.textField.text = text + self.updatePasteVisibility() } } } func updatePasteVisibility() { - self.pasteButton.isHidden = !UIPasteboard.general.hasStrings + let text = self.textField.textField.text ?? "" + self.pasteButton.isHidden = !text.isEmpty || !UIPasteboard.general.hasStrings } func updateCode(_ code: String) { @@ -932,6 +934,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF let text = self.textField.textField.text ?? "" self.proceedNode.isEnabled = !text.isEmpty self.updateNextEnabled?(!text.isEmpty) + + self.updatePasteVisibility() } private func codeChanged(text: String) { @@ -961,7 +965,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF } } } - + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if self.inProgress { return false