From 3dc8189e511a498675f9a1f6e9c48024bf94f6ce Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Tue, 6 Dec 2022 23:23:10 +0400 Subject: [PATCH] Various fixes --- ...AuthorizationSequenceEmailEntryControllerNode.swift | 10 ++++++++++ ...horizationSequencePasswordEntryControllerNode.swift | 10 ++++++++++ .../TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift | 2 +- submodules/TelegramUI/Sources/TextLinkHandling.swift | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift index b8a0c98882..a9aa7a5347 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceEmailEntryControllerNode.swift @@ -88,6 +88,8 @@ final class AuthorizationSequenceEmailEntryControllerNode: ASDisplayNode, UIText } } + private let appearanceTimestamp = CACurrentMediaTime() + init(strings: PresentationStrings, theme: PresentationTheme, mode: AuthorizationSequenceEmailEntryController.Mode) { self.strings = strings self.theme = theme @@ -198,7 +200,15 @@ final class AuthorizationSequenceEmailEntryControllerNode: ASDisplayNode, UIText } func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) { + let previousInputHeight = self.layoutArguments?.0.inputHeight ?? 0.0 + let newInputHeight = layout.inputHeight ?? 0.0 + self.layoutArguments = (layout, navigationBarHeight) + + var layout = layout + if CACurrentMediaTime() - self.appearanceTimestamp < 2.0, newInputHeight < previousInputHeight { + layout = layout.withUpdatedInputHeight(previousInputHeight) + } var insets = layout.insets(options: []) insets.top = layout.statusBarHeight ?? 20.0 diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift index 919d044efe..d53a11d8f1 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationSequencePasswordEntryControllerNode.swift @@ -54,6 +54,8 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT private var timer: SwiftSignalKit.Timer? + private let appearanceTimestamp = CACurrentMediaTime() + init(strings: PresentationStrings, theme: PresentationTheme) { self.strings = strings self.theme = theme @@ -147,8 +149,16 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT } func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) { + let previousInputHeight = self.layoutArguments?.0.inputHeight ?? 0.0 + let newInputHeight = layout.inputHeight ?? 0.0 + self.layoutArguments = (layout, navigationBarHeight) + var layout = layout + if CACurrentMediaTime() - self.appearanceTimestamp < 2.0, newInputHeight < previousInputHeight { + layout = layout.withUpdatedInputHeight(previousInputHeight) + } + let inset: CGFloat = 24.0 let maximumWidth: CGFloat = min(430.0, layout.size.width) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index f19aa7645f..f4b18e4b2a 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3221,7 +3221,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel, nil, nil) } } else { - strongSelf.state = strongSelf.state.withIsEditing(false) + strongSelf.state = strongSelf.state.withIsEditing(false).withUpdatingBio(nil) if let (layout, navigationHeight) = strongSelf.validLayout { strongSelf.scrollNode.view.setContentOffset(CGPoint(), animated: false) strongSelf.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) diff --git a/submodules/TelegramUI/Sources/TextLinkHandling.swift b/submodules/TelegramUI/Sources/TextLinkHandling.swift index 4b6ffa4edd..ef18282655 100644 --- a/submodules/TelegramUI/Sources/TextLinkHandling.swift +++ b/submodules/TelegramUI/Sources/TextLinkHandling.swift @@ -60,6 +60,8 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate context.sharedContext.applicationBindings.openUrl(url) case let .peer(peer, navigation): openResolvedPeerImpl(peer.flatMap(EnginePeer.init), navigation) + case let .botStart(peer, payload): + openResolvedPeerImpl(EnginePeer(peer), .withBotStartPayload(ChatControllerInitialBotStart(payload: payload, behavior: .interactive))) case let .channelMessage(peer, messageId, timecode): if let navigationController = controller.navigationController as? NavigationController { context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(EnginePeer(peer)), subject: .message(id: .id(messageId), highlight: true, timecode: timecode)))