Web app improvements

This commit is contained in:
Ilya Laktyushin
2022-04-10 13:29:22 +04:00
parent 98ba4e7d77
commit aec940a39e
5 changed files with 47 additions and 34 deletions

View File

@@ -131,9 +131,7 @@ final class WebAppWebView: WKWebView {
}
private(set) var didTouchOnce = false
@objc func handleTap() {
self.didTouchOnce = true
}
var onFirstTouch: () -> Void = {}
func scrollToActiveElement(layout: ContainerViewLayout, completion: @escaping (CGPoint) -> Void, transition: ContainedViewLayoutTransition) {
self.evaluateJavaScript(findActiveElementY, completionHandler: { result, _ in
@@ -159,6 +157,15 @@ final class WebAppWebView: WKWebView {
})
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let result = super.hitTest(point, with: event)
if result != nil && !self.didTouchOnce {
self.didTouchOnce = true
self.onFirstTouch()
}
return result
}
override var inputAccessoryView: UIView? {
return nil
}