Web app improvements

This commit is contained in:
Ilya Laktyushin
2022-04-10 15:07:07 +04:00
parent ee86f431d7
commit 1a93f976a7
10 changed files with 64 additions and 28 deletions

View File

@@ -126,8 +126,9 @@ final class WebAppWebView: WKWebView {
})
}
func updateFrame(frame: CGRect, transition: ContainedViewLayoutTransition) {
self.sendEvent(name: "viewport_changed", data: "{height:\(frame.height)}")
func updateMetrics(height: CGFloat, isExpanded: Bool, isStable: Bool, transition: ContainedViewLayoutTransition) {
let data = "{height:\(height), is_expanded:\(isExpanded ? "true" : "false"), is_stable_state:\(isStable ? "true" : "false")}"
self.sendEvent(name: "viewport_changed", data: data)
}
private(set) var didTouchOnce = false