@capgo/capacitor-share-target 7.0.0 → 7.0.2
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.
- package/Package.swift +1 -1
- package/README.md +15 -10
- package/android/src/main/java/app/capgo/sharetarget/CapacitorShareTargetPlugin.java +4 -3
- package/dist/docs.json +234 -0
- package/dist/esm/definitions.d.ts +1 -2
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/web.d.ts +0 -1
- package/dist/plugin.js +1 -1
- package/ios/Sources/CapacitorShareTargetPlugin/CapacitorShareTargetPlugin.swift +1 -1
- package/package.json +2 -3
- package/dist/esm/definitions.d.ts.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/web.d.ts.map +0 -1
package/Package.swift
CHANGED
|
@@ -10,7 +10,7 @@ let package = Package(
|
|
|
10
10
|
targets: ["CapacitorShareTargetPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ CapacitorShareTarget.addListener('shareReceived', (event) => {
|
|
|
69
69
|
|
|
70
70
|
<docgen-index>
|
|
71
71
|
|
|
72
|
-
* [`addListener('shareReceived', ...)`](#addlistenersharereceived)
|
|
72
|
+
* [`addListener('shareReceived', ...)`](#addlistenersharereceived-)
|
|
73
73
|
* [`removeAllListeners()`](#removealllisteners)
|
|
74
74
|
* [`getPluginVersion()`](#getpluginversion)
|
|
75
75
|
* [Interfaces](#interfaces)
|
|
@@ -79,6 +79,11 @@ CapacitorShareTarget.addListener('shareReceived', (event) => {
|
|
|
79
79
|
<docgen-api>
|
|
80
80
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
81
81
|
|
|
82
|
+
Capacitor Share Target Plugin interface.
|
|
83
|
+
|
|
84
|
+
This plugin allows your application to receive content shared from other apps.
|
|
85
|
+
Users can share text, URLs, and files to your app from other applications.
|
|
86
|
+
|
|
82
87
|
### addListener('shareReceived', ...)
|
|
83
88
|
|
|
84
89
|
```typescript
|
|
@@ -146,22 +151,22 @@ Returns the current version of the native plugin implementation.
|
|
|
146
151
|
|
|
147
152
|
Event data received when content is shared to the application.
|
|
148
153
|
|
|
149
|
-
| Prop | Type
|
|
150
|
-
| ----------- |
|
|
151
|
-
| **`title`** | <code>string</code>
|
|
152
|
-
| **`texts`** | <code>string[]</code>
|
|
153
|
-
| **`files`** | <code>SharedFile[]</code>
|
|
154
|
+
| Prop | Type | Description | Since |
|
|
155
|
+
| ----------- | ------------------------- | ------------------------------------------------ | ----- |
|
|
156
|
+
| **`title`** | <code>string</code> | The title of the shared content. | 0.1.0 |
|
|
157
|
+
| **`texts`** | <code>string[]</code> | Array of text content shared to the application. | 0.1.0 |
|
|
158
|
+
| **`files`** | <code>SharedFile[]</code> | Array of files shared to the application. | 0.2.0 |
|
|
154
159
|
|
|
155
160
|
|
|
156
161
|
#### SharedFile
|
|
157
162
|
|
|
158
163
|
Represents a file shared to the application.
|
|
159
164
|
|
|
160
|
-
| Prop | Type | Description
|
|
161
|
-
| -------------- | ------------------- |
|
|
165
|
+
| Prop | Type | Description | Since |
|
|
166
|
+
| -------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
162
167
|
| **`uri`** | <code>string</code> | The URI of the shared file. On Android/iOS this will be a file path or data URL. On web this will be a cached URL accessible via fetch. | 0.1.0 |
|
|
163
|
-
| **`name`** | <code>string</code> | The name of the shared file, with or without extension.
|
|
164
|
-
| **`mimeType`** | <code>string</code> | The MIME type of the shared file.
|
|
168
|
+
| **`name`** | <code>string</code> | The name of the shared file, with or without extension. | 0.1.0 |
|
|
169
|
+
| **`mimeType`** | <code>string</code> | The MIME type of the shared file. | 0.1.0 |
|
|
165
170
|
|
|
166
171
|
</docgen-api>
|
|
167
172
|
|
|
@@ -169,9 +169,10 @@ public class CapacitorShareTargetPlugin extends Plugin {
|
|
|
169
169
|
|
|
170
170
|
File outputFile = new File(cacheDir, fileName);
|
|
171
171
|
|
|
172
|
-
try (
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
try (
|
|
173
|
+
InputStream inputStream = getActivity().getContentResolver().openInputStream(uri);
|
|
174
|
+
FileOutputStream outputStream = new FileOutputStream(outputFile)
|
|
175
|
+
) {
|
|
175
176
|
if (inputStream == null) {
|
|
176
177
|
return null;
|
|
177
178
|
}
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "CapacitorShareTargetPlugin",
|
|
4
|
+
"slug": "capacitorsharetargetplugin",
|
|
5
|
+
"docs": "Capacitor Share Target Plugin interface.\n\nThis plugin allows your application to receive content shared from other apps.\nUsers can share text, URLs, and files to your app from other applications.",
|
|
6
|
+
"tags": [
|
|
7
|
+
{
|
|
8
|
+
"text": "0.1.0",
|
|
9
|
+
"name": "since"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"methods": [
|
|
13
|
+
{
|
|
14
|
+
"name": "addListener",
|
|
15
|
+
"signature": "(eventName: 'shareReceived', listenerFunc: (event: ShareReceivedEvent) => void) => Promise<PluginListenerHandle>",
|
|
16
|
+
"parameters": [
|
|
17
|
+
{
|
|
18
|
+
"name": "eventName",
|
|
19
|
+
"docs": "The event name. Must be 'shareReceived'.",
|
|
20
|
+
"type": "'shareReceived'"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "listenerFunc",
|
|
24
|
+
"docs": "Callback function invoked when content is shared to the app.",
|
|
25
|
+
"type": "(event: ShareReceivedEvent) => void"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
29
|
+
"tags": [
|
|
30
|
+
{
|
|
31
|
+
"name": "since",
|
|
32
|
+
"text": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "param",
|
|
36
|
+
"text": "eventName The event name. Must be 'shareReceived'."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "param",
|
|
40
|
+
"text": "listenerFunc Callback function invoked when content is shared to the app."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "returns",
|
|
44
|
+
"text": "A promise that resolves to a listener handle that can be used to remove the listener."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "example",
|
|
48
|
+
"text": "```typescript\nconst listener = await CapacitorShareTarget.addListener('shareReceived', (event) => {\n console.log('Title:', event.title);\n console.log('Texts:', event.texts);\n event.files?.forEach(file => {\n console.log(`File: ${file.name} (${file.mimeType})`);\n });\n});\n\n// To remove the listener:\nawait listener.remove();\n```"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"docs": "Listen for shareReceived event.\n\nRegisters a listener that will be called when content is shared to the application\nfrom another app. The callback receives event data containing title, texts, and files.",
|
|
52
|
+
"complexTypes": [
|
|
53
|
+
"PluginListenerHandle",
|
|
54
|
+
"ShareReceivedEvent"
|
|
55
|
+
],
|
|
56
|
+
"slug": "addlistenersharereceived-"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "removeAllListeners",
|
|
60
|
+
"signature": "() => Promise<void>",
|
|
61
|
+
"parameters": [],
|
|
62
|
+
"returns": "Promise<void>",
|
|
63
|
+
"tags": [
|
|
64
|
+
{
|
|
65
|
+
"name": "since",
|
|
66
|
+
"text": "0.1.0"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "returns",
|
|
70
|
+
"text": "A promise that resolves when all listeners have been removed."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "example",
|
|
74
|
+
"text": "```typescript\nawait CapacitorShareTarget.removeAllListeners();\n```"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"docs": "Remove all listeners for this plugin.",
|
|
78
|
+
"complexTypes": [],
|
|
79
|
+
"slug": "removealllisteners"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "getPluginVersion",
|
|
83
|
+
"signature": "() => Promise<{ version: string; }>",
|
|
84
|
+
"parameters": [],
|
|
85
|
+
"returns": "Promise<{ version: string; }>",
|
|
86
|
+
"tags": [
|
|
87
|
+
{
|
|
88
|
+
"name": "since",
|
|
89
|
+
"text": "0.1.0"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "returns",
|
|
93
|
+
"text": "A promise that resolves with an object containing the version string."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "throws",
|
|
97
|
+
"text": "An error if something went wrong retrieving the version."
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "example",
|
|
101
|
+
"text": "```typescript\nconst { version} = await CapacitorShareTarget.getPluginVersion();\nconsole.log('Plugin version:', version);\n```"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"docs": "Get the native Capacitor plugin version.\n\nReturns the current version of the native plugin implementation.",
|
|
105
|
+
"complexTypes": [],
|
|
106
|
+
"slug": "getpluginversion"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"properties": []
|
|
110
|
+
},
|
|
111
|
+
"interfaces": [
|
|
112
|
+
{
|
|
113
|
+
"name": "PluginListenerHandle",
|
|
114
|
+
"slug": "pluginlistenerhandle",
|
|
115
|
+
"docs": "",
|
|
116
|
+
"tags": [],
|
|
117
|
+
"methods": [],
|
|
118
|
+
"properties": [
|
|
119
|
+
{
|
|
120
|
+
"name": "remove",
|
|
121
|
+
"tags": [],
|
|
122
|
+
"docs": "",
|
|
123
|
+
"complexTypes": [],
|
|
124
|
+
"type": "() => Promise<void>"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "ShareReceivedEvent",
|
|
130
|
+
"slug": "sharereceivedevent",
|
|
131
|
+
"docs": "Event data received when content is shared to the application.",
|
|
132
|
+
"tags": [
|
|
133
|
+
{
|
|
134
|
+
"text": "0.1.0",
|
|
135
|
+
"name": "since"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"methods": [],
|
|
139
|
+
"properties": [
|
|
140
|
+
{
|
|
141
|
+
"name": "title",
|
|
142
|
+
"tags": [
|
|
143
|
+
{
|
|
144
|
+
"text": "0.1.0",
|
|
145
|
+
"name": "since"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"docs": "The title of the shared content.",
|
|
149
|
+
"complexTypes": [],
|
|
150
|
+
"type": "string"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "texts",
|
|
154
|
+
"tags": [
|
|
155
|
+
{
|
|
156
|
+
"text": "0.1.0",
|
|
157
|
+
"name": "since"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"docs": "Array of text content shared to the application.",
|
|
161
|
+
"complexTypes": [],
|
|
162
|
+
"type": "string[]"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "files",
|
|
166
|
+
"tags": [
|
|
167
|
+
{
|
|
168
|
+
"text": "0.2.0",
|
|
169
|
+
"name": "since"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"docs": "Array of files shared to the application.",
|
|
173
|
+
"complexTypes": [
|
|
174
|
+
"SharedFile"
|
|
175
|
+
],
|
|
176
|
+
"type": "SharedFile[]"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "SharedFile",
|
|
182
|
+
"slug": "sharedfile",
|
|
183
|
+
"docs": "Represents a file shared to the application.",
|
|
184
|
+
"tags": [
|
|
185
|
+
{
|
|
186
|
+
"text": "0.1.0",
|
|
187
|
+
"name": "since"
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"methods": [],
|
|
191
|
+
"properties": [
|
|
192
|
+
{
|
|
193
|
+
"name": "uri",
|
|
194
|
+
"tags": [
|
|
195
|
+
{
|
|
196
|
+
"text": "0.1.0",
|
|
197
|
+
"name": "since"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"docs": "The URI of the shared file. On Android/iOS this will be a file path or data URL.\nOn web this will be a cached URL accessible via fetch.",
|
|
201
|
+
"complexTypes": [],
|
|
202
|
+
"type": "string"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "name",
|
|
206
|
+
"tags": [
|
|
207
|
+
{
|
|
208
|
+
"text": "0.1.0",
|
|
209
|
+
"name": "since"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"docs": "The name of the shared file, with or without extension.",
|
|
213
|
+
"complexTypes": [],
|
|
214
|
+
"type": "string"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "mimeType",
|
|
218
|
+
"tags": [
|
|
219
|
+
{
|
|
220
|
+
"text": "0.1.0",
|
|
221
|
+
"name": "since"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"docs": "The MIME type of the shared file.",
|
|
225
|
+
"complexTypes": [],
|
|
226
|
+
"type": "string"
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"enums": [],
|
|
232
|
+
"typeAliases": [],
|
|
233
|
+
"pluginConfigs": []
|
|
234
|
+
}
|
|
@@ -108,7 +108,7 @@ export interface CapacitorShareTargetPlugin {
|
|
|
108
108
|
*
|
|
109
109
|
* @example
|
|
110
110
|
* ```typescript
|
|
111
|
-
* const { version
|
|
111
|
+
* const { version} = await CapacitorShareTarget.getPluginVersion();
|
|
112
112
|
* console.log('Plugin version:', version);
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
@@ -116,4 +116,3 @@ export interface CapacitorShareTargetPlugin {
|
|
|
116
116
|
version: string;
|
|
117
117
|
}>;
|
|
118
118
|
}
|
|
119
|
-
//# sourceMappingURL=definitions.d.ts.map
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/web.d.ts
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -7,7 +7,7 @@ import Capacitor
|
|
|
7
7
|
*/
|
|
8
8
|
@objc(CapacitorShareTargetPlugin)
|
|
9
9
|
public class CapacitorShareTargetPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
-
private let PLUGIN_VERSION: String = "7.0.
|
|
10
|
+
private let PLUGIN_VERSION: String = "7.0.2"
|
|
11
11
|
public let identifier = "CapacitorShareTargetPlugin"
|
|
12
12
|
public let jsName = "CapacitorShareTarget"
|
|
13
13
|
public let pluginMethods: [CAPPluginMethod] = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-share-target",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Receive shared content from other apps",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
44
44
|
"swiftlint": "node-swiftlint",
|
|
45
45
|
"docgen": "docgen --api CapacitorShareTargetPlugin --output-readme README.md --output-json dist/docs.json",
|
|
46
|
-
"build": "npm run clean && tsc && rollup -c rollup.config.mjs",
|
|
46
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
47
47
|
"clean": "rimraf ./dist",
|
|
48
48
|
"watch": "tsc --watch",
|
|
49
49
|
"prepublishOnly": "npm run build"
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"@ionic/eslint-config": "^0.4.0",
|
|
58
58
|
"@ionic/prettier-config": "^4.0.0",
|
|
59
59
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
60
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
61
60
|
"@types/node": "^22.13.1",
|
|
62
61
|
"eslint": "^8.57.0",
|
|
63
62
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;;;OAIG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,CACT,SAAS,EAAE,eAAe,EAC1B,YAAY,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAChD,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;;;;;;OAUG;IACH,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD"}
|
package/dist/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAEhE,QAAA,MAAM,oBAAoB,4BAExB,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/esm/web.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAEhE,qBAAa,uBAAwB,SAAQ,SAAU,YAAW,0BAA0B;IACpF,gBAAgB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGvD"}
|