@capgo/capacitor-share-target 8.0.25 → 8.0.27
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import Capacitor
|
|
3
|
+
import UIKit
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
@@ -7,7 +8,7 @@ import Capacitor
|
|
|
7
8
|
*/
|
|
8
9
|
@objc(CapacitorShareTargetPlugin)
|
|
9
10
|
public class CapacitorShareTargetPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
-
private let pluginVersion: String = "8.0.
|
|
11
|
+
private let pluginVersion: String = "8.0.27"
|
|
11
12
|
public let identifier = "CapacitorShareTargetPlugin"
|
|
12
13
|
public let jsName = "CapacitorShareTarget"
|
|
13
14
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -25,6 +26,14 @@ public class CapacitorShareTargetPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
25
26
|
object: nil
|
|
26
27
|
)
|
|
27
28
|
|
|
29
|
+
// Also check when the app returns to foreground (share extensions often cannot open the host app)
|
|
30
|
+
NotificationCenter.default.addObserver(
|
|
31
|
+
self,
|
|
32
|
+
selector: #selector(handleAppDidBecomeActive),
|
|
33
|
+
name: UIApplication.didBecomeActiveNotification,
|
|
34
|
+
object: nil
|
|
35
|
+
)
|
|
36
|
+
|
|
28
37
|
// Check for shared data on app launch
|
|
29
38
|
checkForSharedContent()
|
|
30
39
|
}
|
|
@@ -109,6 +118,10 @@ public class CapacitorShareTargetPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
109
118
|
notifyListeners("shareReceived", data: shareEvent, retainUntilConsumed: true)
|
|
110
119
|
}
|
|
111
120
|
|
|
121
|
+
@objc private func handleAppDidBecomeActive(_ notification: Notification) {
|
|
122
|
+
checkForSharedContent()
|
|
123
|
+
}
|
|
124
|
+
|
|
112
125
|
@objc func getPluginVersion(_ call: CAPPluginCall) {
|
|
113
126
|
call.resolve(["version": self.pluginVersion])
|
|
114
127
|
}
|