@capgo/capacitor-inappbrowser 8.12.2-beta.pr634.541.1 → 8.12.2-beta.pr634.545.1

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.
@@ -250,6 +250,11 @@ enum CustomWebViewFrameSupport {
250
250
  }
251
251
 
252
252
  enum ReloadGestureSupport {
253
+ /// Ordinary page finishes must not clear an armed pull still held by the user.
254
+ static func shouldApplyStopReloadGesture(reloadFromGestureInProgress: Bool) -> Bool {
255
+ reloadFromGestureInProgress
256
+ }
257
+
253
258
  /// UIRefreshControl may fire valueChanged while the finger is still down.
254
259
  /// Match browser UX: commit reload only after touch end.
255
260
  static func shouldDeferReloadUntilTouchEnd(isTracking: Bool, isDragging: Bool) -> Bool {
@@ -274,7 +279,7 @@ enum ReloadGestureSupport {
274
279
  }
275
280
 
276
281
  /// Resting offset for the current adjusted top inset (safe-area aware).
277
- /// - forceToRestingTop: after gesture reload, always snap to resting top (fixes clipped header).
282
+ /// - Parameter forceToRestingTop: After gesture reload, always snap to resting top (fixes clipped header).
278
283
  /// Otherwise only un-overscroll after a cancelled pull.
279
284
  static func contentOffsetYAfterReloadReset(
280
285
  currentY: CGFloat,
@@ -117,17 +117,18 @@ extension WKWebViewController {
117
117
  }
118
118
 
119
119
  func stopReloadGesture(for navigation: WKNavigation? = nil) {
120
- pendingReloadFromGesture = false
120
+ guard ReloadGestureSupport.shouldApplyStopReloadGesture(
121
+ reloadFromGestureInProgress: reloadFromGestureInProgress
122
+ ) else { return }
121
123
 
122
124
  // Ignore unrelated navigation callbacks while a gesture reload is in flight.
123
- if reloadFromGestureInProgress,
124
- let expected = reloadGestureNavigation,
125
+ if let expected = reloadGestureNavigation,
125
126
  let navigation,
126
127
  expected !== navigation {
127
128
  return
128
129
  }
129
130
 
130
- let shouldResetScroll = reloadFromGestureInProgress
131
+ pendingReloadFromGesture = false
131
132
  reloadFromGestureInProgress = false
132
133
  reloadGestureNavigation = nil
133
134
  reloadGestureArmedPullDistance = 0
@@ -136,8 +137,6 @@ extension WKWebViewController {
136
137
  let scrollView = activeWebView.scrollView
137
138
  scrollView.refreshControl?.endRefreshing()
138
139
 
139
- guard shouldResetScroll else { return }
140
-
141
140
  // UIRefreshControl + WKWebView.reload() often leave offset at 0 instead of
142
141
  // -adjustedContentInset.top (clips header ~safe-area) and block the next pull.
143
142
  DispatchQueue.main.async { [weak self] in
@@ -3677,10 +3677,16 @@ extension WKWebViewController: WKNavigationDelegate {
3677
3677
 
3678
3678
  public func webView(_ webView: WKWebView, navigationAction: WKNavigationAction, didBecome download: WKDownload) {
3679
3679
  register(download: download, response: nil, sourceURL: navigationAction.request.url?.absoluteString)
3680
+ stopReloadGesture()
3680
3681
  }
3681
3682
 
3682
3683
  public func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) {
3683
3684
  register(download: download, response: navigationResponse.response)
3685
+ stopReloadGesture()
3686
+ }
3687
+
3688
+ public func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
3689
+ stopReloadGesture()
3684
3690
  }
3685
3691
 
3686
3692
  // MARK: - Dimension Management
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-inappbrowser",
3
- "version": "8.12.2-beta.pr634.541.1",
3
+ "version": "8.12.2-beta.pr634.545.1",
4
4
  "description": "Capacitor plugin in app browser",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",