@capacitor/share 1.0.4 → 1.1.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.
- package/CHANGELOG.md +52 -0
- package/README.md +23 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/capacitorjs/plugins/share/SharePlugin.java +7 -0
- package/dist/docs.json +38 -0
- package/dist/esm/definitions.d.ts +14 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -1
- package/dist/esm/web.js +8 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +8 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +9 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/SharePlugin.m +1 -0
- package/ios/Plugin/SharePlugin.swift +6 -0
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.1](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.1.0...@capacitor/share@1.1.1) (2022-01-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.7...@capacitor/share@1.1.0) (2022-01-10)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **share:** Add canShare method to check availability ([#748](https://github.com/ionic-team/capacitor-plugins/issues/748)) ([3883d82](https://github.com/ionic-team/capacitor-plugins/commit/3883d82952a4453797b86c562af27f9b05e82a18))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.6...@capacitor/share@1.0.7) (2021-11-03)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @capacitor/share
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [1.0.6](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.5...@capacitor/share@1.0.6) (2021-10-14)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [1.0.5](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.4...@capacitor/share@1.0.5) (2021-10-13)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
## [1.0.4](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.3...@capacitor/share@1.0.4) (2021-09-01)
|
|
7
59
|
|
|
8
60
|
**Note:** Version bump only for package @capacitor/share
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ Each platform uses a different set of fields, but you should supply them all.
|
|
|
31
31
|
|
|
32
32
|
<docgen-index>
|
|
33
33
|
|
|
34
|
+
* [`canShare()`](#canshare)
|
|
34
35
|
* [`share(...)`](#share)
|
|
35
36
|
* [Interfaces](#interfaces)
|
|
36
37
|
|
|
@@ -39,6 +40,21 @@ Each platform uses a different set of fields, but you should supply them all.
|
|
|
39
40
|
<docgen-api>
|
|
40
41
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
41
42
|
|
|
43
|
+
### canShare()
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
canShare() => Promise<CanShareResult>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Check if sharing is supported.
|
|
50
|
+
|
|
51
|
+
**Returns:** <code>Promise<<a href="#canshareresult">CanShareResult</a>></code>
|
|
52
|
+
|
|
53
|
+
**Since:** 1.1.0
|
|
54
|
+
|
|
55
|
+
--------------------
|
|
56
|
+
|
|
57
|
+
|
|
42
58
|
### share(...)
|
|
43
59
|
|
|
44
60
|
```typescript
|
|
@@ -61,6 +77,13 @@ Show a Share modal for sharing content with other apps
|
|
|
61
77
|
### Interfaces
|
|
62
78
|
|
|
63
79
|
|
|
80
|
+
#### CanShareResult
|
|
81
|
+
|
|
82
|
+
| Prop | Type | Description | Since |
|
|
83
|
+
| ----------- | -------------------- | ------------------------------------ | ----- |
|
|
84
|
+
| **`value`** | <code>boolean</code> | Whether sharing is supported or not. | 1.1.0 |
|
|
85
|
+
|
|
86
|
+
|
|
64
87
|
#### ShareResult
|
|
65
88
|
|
|
66
89
|
| Prop | Type | Description | Since |
|
package/android/build.gradle
CHANGED
|
@@ -50,6 +50,13 @@ public class SharePlugin extends Plugin {
|
|
|
50
50
|
isPresenting = false;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
@PluginMethod
|
|
54
|
+
public void canShare(PluginCall call) {
|
|
55
|
+
JSObject callResult = new JSObject();
|
|
56
|
+
callResult.put("value", true);
|
|
57
|
+
call.resolve(callResult);
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
@PluginMethod
|
|
54
61
|
public void share(PluginCall call) {
|
|
55
62
|
if (!isPresenting) {
|
package/dist/docs.json
CHANGED
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
"docs": "",
|
|
6
6
|
"tags": [],
|
|
7
7
|
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "canShare",
|
|
10
|
+
"signature": "() => Promise<CanShareResult>",
|
|
11
|
+
"parameters": [],
|
|
12
|
+
"returns": "Promise<CanShareResult>",
|
|
13
|
+
"tags": [
|
|
14
|
+
{
|
|
15
|
+
"name": "since",
|
|
16
|
+
"text": "1.1.0"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"docs": "Check if sharing is supported.",
|
|
20
|
+
"complexTypes": [
|
|
21
|
+
"CanShareResult"
|
|
22
|
+
],
|
|
23
|
+
"slug": "canshare"
|
|
24
|
+
},
|
|
8
25
|
{
|
|
9
26
|
"name": "share",
|
|
10
27
|
"signature": "(options: ShareOptions) => Promise<ShareResult>",
|
|
@@ -33,6 +50,27 @@
|
|
|
33
50
|
"properties": []
|
|
34
51
|
},
|
|
35
52
|
"interfaces": [
|
|
53
|
+
{
|
|
54
|
+
"name": "CanShareResult",
|
|
55
|
+
"slug": "canshareresult",
|
|
56
|
+
"docs": "",
|
|
57
|
+
"tags": [],
|
|
58
|
+
"methods": [],
|
|
59
|
+
"properties": [
|
|
60
|
+
{
|
|
61
|
+
"name": "value",
|
|
62
|
+
"tags": [
|
|
63
|
+
{
|
|
64
|
+
"text": "1.1.0",
|
|
65
|
+
"name": "since"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"docs": "Whether sharing is supported or not.",
|
|
69
|
+
"complexTypes": [],
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
36
74
|
{
|
|
37
75
|
"name": "ShareResult",
|
|
38
76
|
"slug": "shareresult",
|
|
@@ -37,7 +37,21 @@ export interface ShareResult {
|
|
|
37
37
|
*/
|
|
38
38
|
activityType?: string;
|
|
39
39
|
}
|
|
40
|
+
export interface CanShareResult {
|
|
41
|
+
/**
|
|
42
|
+
* Whether sharing is supported or not.
|
|
43
|
+
*
|
|
44
|
+
* @since 1.1.0
|
|
45
|
+
*/
|
|
46
|
+
value: boolean;
|
|
47
|
+
}
|
|
40
48
|
export interface SharePlugin {
|
|
49
|
+
/**
|
|
50
|
+
* Check if sharing is supported.
|
|
51
|
+
*
|
|
52
|
+
* @since 1.1.0
|
|
53
|
+
*/
|
|
54
|
+
canShare(): Promise<CanShareResult>;
|
|
41
55
|
/**
|
|
42
56
|
* Show a Share modal for sharing content with other apps
|
|
43
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface ShareOptions {\n /**\n * Set a title for any message. This will be the subject\n * if sharing to email\n *\n * @since 1.0.0\n */\n title?: string;\n\n /**\n * Set some text to share\n *\n * @since 1.0.0\n */\n text?: string;\n\n /**\n * Set a URL to share, can be http, https or file:// URL\n *\n * @since 1.0.0\n */\n url?: string;\n\n /**\n * Set a title for the share modal.\n * This option is only supported on Android.\n *\n * @since 1.0.0\n */\n dialogTitle?: string;\n}\n\nexport interface ShareResult {\n /**\n * Identifier of the app that received the share action.\n * Can be an empty string in some cases.\n *\n * On web it will be undefined.\n *\n * @since 1.0.0\n */\n activityType?: string;\n}\n\nexport interface CanShareResult {\n /**\n * Whether sharing is supported or not.\n *\n * @since 1.1.0\n */\n value: boolean;\n}\n\nexport interface SharePlugin {\n /**\n * Check if sharing is supported.\n *\n * @since 1.1.0\n */\n canShare(): Promise<CanShareResult>;\n\n /**\n * Show a Share modal for sharing content with other apps\n *\n * @since 1.0.0\n */\n share(options: ShareOptions): Promise<ShareResult>;\n}\n"]}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,KAAK,GAAG,cAAc,CAAc,OAAO,EAAE;IACjD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;CACvD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,KAAK,GAAG,cAAc,CAAc,OAAO,EAAE;IACjD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;CACvD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { SharePlugin } from './definitions';\n\nconst Share = registerPlugin<SharePlugin>('Share', {\n web: () => import('./web').then(m => new m.ShareWeb()),\n});\n\nexport * from './definitions';\nexport { Share };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { ShareOptions, SharePlugin, ShareResult } from './definitions';
|
|
2
|
+
import type { CanShareResult, ShareOptions, SharePlugin, ShareResult } from './definitions';
|
|
3
3
|
export declare class ShareWeb extends WebPlugin implements SharePlugin {
|
|
4
|
+
canShare(): Promise<CanShareResult>;
|
|
4
5
|
share(options: ShareOptions): Promise<ShareResult>;
|
|
5
6
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
2
|
export class ShareWeb extends WebPlugin {
|
|
3
|
+
async canShare() {
|
|
4
|
+
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
5
|
+
return { value: false };
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
return { value: true };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
async share(options) {
|
|
4
12
|
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
5
13
|
throw this.unavailable('Share API not available in this browser');
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,QAAS,SAAQ,SAAS;IACrC,KAAK,CAAC,QAAQ;QACZ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YACxD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;SACzB;aAAM;YACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACxB;IACH,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,OAAqB;QAC/B,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YACxD,MAAM,IAAI,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;SACnE;QAED,MAAM,SAAS,CAAC,KAAK,CAAC;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CanShareResult,\n ShareOptions,\n SharePlugin,\n ShareResult,\n} from './definitions';\n\nexport class ShareWeb extends WebPlugin implements SharePlugin {\n async canShare(): Promise<CanShareResult> {\n if (typeof navigator === 'undefined' || !navigator.share) {\n return { value: false };\n } else {\n return { value: true };\n }\n }\n async share(options: ShareOptions): Promise<ShareResult> {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -9,6 +9,14 @@ const Share = core.registerPlugin('Share', {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
class ShareWeb extends core.WebPlugin {
|
|
12
|
+
async canShare() {
|
|
13
|
+
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
14
|
+
return { value: false };
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return { value: true };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
12
20
|
async share(options) {
|
|
13
21
|
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
14
22
|
throw this.unavailable('Share API not available in this browser');
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Share = registerPlugin('Share', {\n web: () => import('./web').then(m => new m.ShareWeb()),\n});\nexport * from './definitions';\nexport { Share };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ShareWeb extends WebPlugin {\n async share(options) {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,KAAK,GAAGA,mBAAc,CAAC,OAAO,EAAE;AACtC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,QAAQ,SAASC,cAAS,CAAC;AACxC,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AAClE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;AAC9E,SAAS;AACT,QAAQ,MAAM,SAAS,CAAC,KAAK,CAAC;AAC9B,YAAY,KAAK,EAAE,OAAO,CAAC,KAAK;AAChC,YAAY,IAAI,EAAE,OAAO,CAAC,IAAI;AAC9B,YAAY,GAAG,EAAE,OAAO,CAAC,GAAG;AAC5B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Share = registerPlugin('Share', {\n web: () => import('./web').then(m => new m.ShareWeb()),\n});\nexport * from './definitions';\nexport { Share };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ShareWeb extends WebPlugin {\n async canShare() {\n if (typeof navigator === 'undefined' || !navigator.share) {\n return { value: false };\n }\n else {\n return { value: true };\n }\n }\n async share(options) {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,KAAK,GAAGA,mBAAc,CAAC,OAAO,EAAE;AACtC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,QAAQ,SAASC,cAAS,CAAC;AACxC,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AAClE,YAAY,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACpC,SAAS;AACT,aAAa;AACb,YAAY,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACnC,SAAS;AACT,KAAK;AACL,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;AACzB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AAClE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;AAC9E,SAAS;AACT,QAAQ,MAAM,SAAS,CAAC,KAAK,CAAC;AAC9B,YAAY,KAAK,EAAE,OAAO,CAAC,KAAK;AAChC,YAAY,IAAI,EAAE,OAAO,CAAC,IAAI;AAC9B,YAAY,GAAG,EAAE,OAAO,CAAC,GAAG;AAC5B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -6,6 +6,14 @@ var capacitorShare = (function (exports, core) {
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
class ShareWeb extends core.WebPlugin {
|
|
9
|
+
async canShare() {
|
|
10
|
+
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
11
|
+
return { value: false };
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return { value: true };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
9
17
|
async share(options) {
|
|
10
18
|
if (typeof navigator === 'undefined' || !navigator.share) {
|
|
11
19
|
throw this.unavailable('Share API not available in this browser');
|
|
@@ -30,5 +38,5 @@ var capacitorShare = (function (exports, core) {
|
|
|
30
38
|
|
|
31
39
|
return exports;
|
|
32
40
|
|
|
33
|
-
}({}, capacitorExports)
|
|
41
|
+
})({}, capacitorExports);
|
|
34
42
|
//# sourceMappingURL=plugin.js.map
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Share = registerPlugin('Share', {\n web: () => import('./web').then(m => new m.ShareWeb()),\n});\nexport * from './definitions';\nexport { Share };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ShareWeb extends WebPlugin {\n async share(options) {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,KAAK,GAAGA,mBAAc,CAAC,OAAO,EAAE;IACtC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,QAAQ,SAASC,cAAS,CAAC;IACxC,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;IACzB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;IAClE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAC9E,SAAS;IACT,QAAQ,MAAM,SAAS,CAAC,KAAK,CAAC;IAC9B,YAAY,KAAK,EAAE,OAAO,CAAC,KAAK;IAChC,YAAY,IAAI,EAAE,OAAO,CAAC,IAAI;IAC9B,YAAY,GAAG,EAAE,OAAO,CAAC,GAAG;IAC5B,SAAS,CAAC,CAAC;IACX,QAAQ,OAAO,EAAE,CAAC;IAClB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Share = registerPlugin('Share', {\n web: () => import('./web').then(m => new m.ShareWeb()),\n});\nexport * from './definitions';\nexport { Share };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ShareWeb extends WebPlugin {\n async canShare() {\n if (typeof navigator === 'undefined' || !navigator.share) {\n return { value: false };\n }\n else {\n return { value: true };\n }\n }\n async share(options) {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,KAAK,GAAGA,mBAAc,CAAC,OAAO,EAAE;IACtC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,QAAQ,SAASC,cAAS,CAAC;IACxC,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;IAClE,YAAY,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACpC,SAAS;IACT,aAAa;IACb,YAAY,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACnC,SAAS;IACT,KAAK;IACL,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;IACzB,QAAQ,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;IAClE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAC9E,SAAS;IACT,QAAQ,MAAM,SAAS,CAAC,KAAK,CAAC;IAC9B,YAAY,KAAK,EAAE,OAAO,CAAC,KAAK;IAChC,YAAY,IAAI,EAAE,OAAO,CAAC,IAAI;IAC9B,YAAY,GAAG,EAAE,OAAO,CAAC,GAAG;IAC5B,SAAS,CAAC,CAAC;IACX,QAAQ,OAAO,EAAE,CAAC;IAClB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
package/ios/Plugin/SharePlugin.m
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
5
|
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
6
|
CAP_PLUGIN(SharePlugin, "Share",
|
|
7
|
+
CAP_PLUGIN_METHOD(canShare, CAPPluginReturnPromise);
|
|
7
8
|
CAP_PLUGIN_METHOD(share, CAPPluginReturnPromise);
|
|
8
9
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/share",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
34
|
"verify:web": "npm run build",
|
|
35
35
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
36
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint --
|
|
36
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
37
37
|
"eslint": "eslint . --ext ts",
|
|
38
38
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
39
39
|
"swiftlint": "node-swiftlint",
|
|
@@ -42,13 +42,12 @@
|
|
|
42
42
|
"clean": "rimraf ./dist",
|
|
43
43
|
"watch": "tsc --watch",
|
|
44
44
|
"prepublishOnly": "npm run build",
|
|
45
|
-
"postpublish": "npm run publish:cocoapod",
|
|
46
45
|
"publish:cocoapod": "pod trunk push ./CapacitorShare.podspec --allow-warnings"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@capacitor/android": "^3.0.0",
|
|
50
49
|
"@capacitor/core": "^3.0.0",
|
|
51
|
-
"@capacitor/docgen": "0.0.
|
|
50
|
+
"@capacitor/docgen": "0.0.18",
|
|
52
51
|
"@capacitor/ios": "^3.0.0",
|
|
53
52
|
"@ionic/eslint-config": "^0.3.0",
|
|
54
53
|
"@ionic/prettier-config": "~1.0.1",
|
|
@@ -80,5 +79,5 @@
|
|
|
80
79
|
"publishConfig": {
|
|
81
80
|
"access": "public"
|
|
82
81
|
},
|
|
83
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "f18ee6482e1ec8e5fb0290d51f598397133af990"
|
|
84
83
|
}
|