@capacitor/share 8.0.2 → 8.0.3-nightly-20260918T151250.0

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.
@@ -64,12 +64,28 @@ public class SharePlugin: CAPPlugin, CAPBridgedPlugin {
64
64
  }
65
65
 
66
66
  }
67
- if self?.bridge?.viewController?.presentedViewController != nil {
68
- call.reject("Can't share while sharing is in progress")
69
- return
67
+ // Present from the topmost presented view controller so the share sheet appears
68
+ // above any view controller the app has presented over the webview. With nothing
69
+ // presented this resolves to the bridge view controller, i.e. unchanged behaviour.
70
+ // A share is only in progress when a share sheet is already presented.
71
+ var presenter = self?.bridge?.viewController
72
+ while let presented = presenter?.presentedViewController {
73
+ if presented is UIActivityViewController {
74
+ call.reject("Can't share while sharing is in progress")
75
+ return
76
+ }
77
+ presenter = presented
78
+ }
79
+ // `setCenteredPopover` anchors to the bridge view controller's view, which is not in
80
+ // the presenter's hierarchy when presenting from a different view controller. Anchor
81
+ // the popover to the presenting view controller's own view instead, centered and
82
+ // without an arrow, matching `setCenteredPopover` behaviour.
83
+ if let popover = actionController.popoverPresentationController, let presenterView = presenter?.view {
84
+ popover.sourceView = presenterView
85
+ popover.sourceRect = CGRect(x: presenterView.bounds.midX, y: presenterView.bounds.midY, width: 0, height: 0)
86
+ popover.permittedArrowDirections = []
70
87
  }
71
- self?.setCenteredPopover(actionController)
72
- self?.bridge?.viewController?.present(actionController, animated: true, completion: nil)
88
+ presenter?.present(actionController, animated: true, completion: nil)
73
89
  }
74
90
  }
75
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/share",
3
- "version": "8.0.2",
3
+ "version": "8.0.3-nightly-20260918T151250.0",
4
4
  "description": "The Share API provides methods for sharing content in any sharing-enabled apps the user may have installed.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "467dafd615514c19701d75fe6edc143901e4dc93"
84
+ "gitHead": "ed6cf8f1f64ce63ab7630c41831b6606c9c6636c"
85
85
  }