@capgo/capacitor-stream-call 0.0.33 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ import WebKit
|
|
|
5
5
|
class TouchInterceptView: UIView {
|
|
6
6
|
private weak var webView: UIView?
|
|
7
7
|
private weak var overlayView: UIView?
|
|
8
|
+
private var touchStartPoint: CGPoint?
|
|
8
9
|
|
|
9
10
|
func setupWithWebView(_ webView: UIView, overlayView: UIView) {
|
|
10
11
|
self.webView = webView
|
|
@@ -43,6 +44,7 @@ class TouchInterceptView: UIView {
|
|
|
43
44
|
let y = Int(locationInWeb.y)
|
|
44
45
|
let js = """
|
|
45
46
|
(() => {
|
|
47
|
+
console.log('forwardClickToWeb', \(x), \(y));
|
|
46
48
|
const x = \(x); const y = \(y);
|
|
47
49
|
const el = document.elementFromPoint(x, y);
|
|
48
50
|
if (!el) return 'NO_ELEM';
|
|
@@ -75,57 +77,28 @@ class TouchInterceptView: UIView {
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
override func
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if let overlayView = self.overlayView, !overlayView.isHidden {
|
|
84
|
-
let overlayPoint = self.convert(point, to: overlayView)
|
|
85
|
-
if let overlayHit = nonGreedyInteractiveHitTest(in: overlayView, point: overlayPoint, with: event) {
|
|
86
|
-
os_log(.debug, "TouchInterceptView: hitTest - Overlay view %{public}s at %{public}s", String(describing: overlayHit), String(describing: overlayPoint))
|
|
87
|
-
return overlayHit
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// 2. webView fallback
|
|
91
|
-
if let webView = self.webView {
|
|
92
|
-
let webPoint = self.convert(point, to: webView)
|
|
93
|
-
let result = webView.hitTest(webPoint, with: event)
|
|
94
|
-
os_log(.debug, "TouchInterceptView: hitTest - WebView result %{public}s at %{public}s", String(describing: result), String(describing: webPoint))
|
|
95
|
-
return result
|
|
80
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
81
|
+
os_log(.debug, "TouchInterceptView: touchesBegan at %{public}s", String(describing: touches))
|
|
82
|
+
if let touch = touches.first {
|
|
83
|
+
touchStartPoint = touch.location(in: self)
|
|
84
|
+
os_log(.debug, "TouchInterceptView: touchesBegan at %{public}s", String(describing: touchStartPoint))
|
|
96
85
|
}
|
|
97
|
-
|
|
98
|
-
return nil
|
|
86
|
+
super.touchesBegan(touches, with: event)
|
|
99
87
|
}
|
|
100
88
|
|
|
101
|
-
override func
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let overlayViewConsidersPointInside = overlayView.point(inside: overlayPoint, with: event)
|
|
107
|
-
os_log(.debug, "TouchInterceptView: point(inside) - webView nil. Overlay (%{public}s) for converted point %{public}s = %s", String(describing: overlayViewConsidersPointInside), String(describing: overlayPoint), String(describing: overlayViewConsidersPointInside))
|
|
108
|
-
return overlayViewConsidersPointInside
|
|
109
|
-
}
|
|
110
|
-
return super.point(inside: point, with: event)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let webViewPoint = self.convert(point, to: webView)
|
|
114
|
-
let webViewConsidersPointInside = webView.point(inside: webViewPoint, with: event)
|
|
115
|
-
|
|
116
|
-
if let overlayView = self.overlayView, !overlayView.isHidden {
|
|
117
|
-
let overlayPoint = self.convert(point, to: overlayView)
|
|
118
|
-
let overlayViewConsidersPointInside = overlayView.point(inside: overlayPoint, with: event)
|
|
119
|
-
let result = webViewConsidersPointInside || overlayViewConsidersPointInside
|
|
120
|
-
os_log(.debug, "TouchInterceptView: point(inside) - WebView (%{public}s at %{public}s) OR Visible Overlay (%{public}s at %{public}s) for original point %{public}s = %s", String(describing: webViewConsidersPointInside), String(describing: webViewPoint), String(describing: overlayViewConsidersPointInside), String(describing: overlayPoint), String(describing: point), String(describing: result))
|
|
121
|
-
return result
|
|
122
|
-
} else {
|
|
123
|
-
if self.overlayView == nil {
|
|
124
|
-
os_log(.debug, "TouchInterceptView: point(inside) - Overlay nil. WebView (%{public}s at %{public}s) for original point %{public}s = %s", String(describing: webViewConsidersPointInside), String(describing: webViewPoint), String(describing: point), String(describing: webViewConsidersPointInside))
|
|
125
|
-
} else {
|
|
126
|
-
os_log(.debug, "TouchInterceptView: point(inside) - Overlay hidden. WebView (%{public}s at %{public}s) for original point %{public}s = %s", String(describing: webViewConsidersPointInside), String(describing: webViewPoint), String(describing: point), String(describing: webViewConsidersPointInside))
|
|
127
|
-
}
|
|
128
|
-
return webViewConsidersPointInside
|
|
89
|
+
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
90
|
+
os_log(.debug, "TouchInterceptView: touchesEnded at %{public}s", String(describing: touches))
|
|
91
|
+
if let startPoint = touchStartPoint {
|
|
92
|
+
os_log(.debug, "TouchInterceptView: touchesEnded - forwarding click to web at %{public}s", String(describing: startPoint))
|
|
93
|
+
forwardClickToWeb(at: startPoint)
|
|
129
94
|
}
|
|
95
|
+
touchStartPoint = nil
|
|
96
|
+
super.touchesEnded(touches, with: event)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
100
|
+
os_log(.debug, "TouchInterceptView: touchesCancelled at %{public}s", String(describing: touches))
|
|
101
|
+
touchStartPoint = nil
|
|
102
|
+
super.touchesCancelled(touches, with: event)
|
|
130
103
|
}
|
|
131
104
|
}
|
package/package.json
CHANGED