From be29ac01e2133f76bbc831af5c2f2e785e2ad76a Mon Sep 17 00:00:00 2001 From: migmatore Date: Mon, 24 Jun 2024 16:00:44 +0300 Subject: [PATCH] fix issue #1410 and #1298 --- submodules/WebUI/Sources/WebAppWebView.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/submodules/WebUI/Sources/WebAppWebView.swift b/submodules/WebUI/Sources/WebAppWebView.swift index 169383d6f7d..cb3a97b0642 100644 --- a/submodules/WebUI/Sources/WebAppWebView.swift +++ b/submodules/WebUI/Sources/WebAppWebView.swift @@ -187,10 +187,6 @@ final class WebAppWebView: WKWebView { } contentView?.removeInteraction(dragInteraction) }) - - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) } } @@ -214,13 +210,13 @@ final class WebAppWebView: WKWebView { if let result = result as? CGFloat { Queue.mainQueue().async { let convertedY = result - self.scrollView.contentOffset.y - let viewportHeight = self.frame.height - (layout.inputHeight ?? 0.0) + 26.0 + let viewportHeight = self.frame.height - (layout.inputHeight ?? 0.0) if convertedY < 0.0 || (convertedY + 44.0) > viewportHeight { let targetOffset: CGFloat if convertedY < 0.0 { targetOffset = max(0.0, result - 36.0) } else { - targetOffset = max(0.0, result + 60.0 - viewportHeight) + targetOffset = max(0.0, result - viewportHeight - 46.0) } let contentOffset = CGPoint(x: 0.0, y: targetOffset) completion(contentOffset)