@capacitor/share 1.1.0 → 4.0.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,59 @@
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
+ # 4.0.0-beta.0 (2022-06-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **share:** avoid crash when targeting SDK 31 ([#913](https://github.com/ionic-team/capacitor-plugins/issues/913)) ([275da5f](https://github.com/ionic-team/capacitor-plugins/commit/275da5fc23cf0ef173276d9027f8c5ffdb8a5432))
12
+ * add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
13
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
14
+ * 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))
15
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
16
+ * **share:** Avoid SecurityError on Android 10 file share ([#63](https://github.com/ionic-team/capacitor-plugins/issues/63)) ([b6a8191](https://github.com/ionic-team/capacitor-plugins/commit/b6a819115c84fe533a97bad9f8784499c492ddcd))
17
+ * **share:** Prevent share if sharing in progress ([#489](https://github.com/ionic-team/capacitor-plugins/issues/489)) ([3479783](https://github.com/ionic-team/capacitor-plugins/commit/34797837363588f4511403e39017bf6b656685cb))
18
+ * **share:** set type to */* if no mine type can be found ([#324](https://github.com/ionic-team/capacitor-plugins/issues/324)) ([40d4baa](https://github.com/ionic-team/capacitor-plugins/commit/40d4baa8b89e55b094ee568daecf8c63a53fc7cb))
19
+ * support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336))
20
+
21
+
22
+ ### Features
23
+
24
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
25
+ * set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
26
+ * set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
27
+ * Share plugin ([#39](https://github.com/ionic-team/capacitor-plugins/issues/39)) ([9076c8e](https://github.com/ionic-team/capacitor-plugins/commit/9076c8e6b83b80514d23c809035fd7579b2e607a))
28
+ * Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
29
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
30
+ * **android:** implements Activity Result API changes for permissions and activity results ([#222](https://github.com/ionic-team/capacitor-plugins/issues/222)) ([f671b9f](https://github.com/ionic-team/capacitor-plugins/commit/f671b9f4b472806ef43db6dcf302d4503cf1828c))
31
+ * **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))
32
+
33
+
34
+
35
+
36
+
37
+ ## [1.1.2](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.1.1...@capacitor/share@1.1.2) (2022-03-03)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **share:** correct whatsapp file sharing ([#816](https://github.com/ionic-team/capacitor-plugins/issues/816)) ([18b10c4](https://github.com/ionic-team/capacitor-plugins/commit/18b10c493e26a6b62031c3bfb57e1ffbbf926c41))
43
+
44
+
45
+
46
+
47
+
48
+ ## [1.1.1](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.1.0...@capacitor/share@1.1.1) (2022-01-19)
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * 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))
54
+
55
+
56
+
57
+
58
+
6
59
  # [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/share@1.0.7...@capacitor/share@1.1.0) (2022-01-10)
7
60
 
8
61
 
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'share/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
@@ -1,9 +1,9 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.3.2'
5
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
6
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.8.0'
5
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
6
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
7
7
  }
8
8
 
9
9
  buildscript {
@@ -12,17 +12,17 @@ buildscript {
12
12
  mavenCentral()
13
13
  }
14
14
  dependencies {
15
- classpath 'com.android.tools.build:gradle:4.2.1'
15
+ classpath 'com.android.tools.build:gradle:7.2.1'
16
16
  }
17
17
  }
18
18
 
19
19
  apply plugin: 'com.android.library'
20
20
 
21
21
  android {
22
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
22
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
23
23
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
26
26
  versionCode 1
27
27
  versionName "1.0"
28
28
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,14 +37,13 @@ android {
37
37
  abortOnError false
38
38
  }
39
39
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
40
+ sourceCompatibility JavaVersion.VERSION_11
41
+ targetCompatibility JavaVersion.VERSION_11
42
42
  }
43
43
  }
44
44
 
45
45
  repositories {
46
46
  google()
47
- jcenter()
48
47
  mavenCentral()
49
48
  }
50
49
 
@@ -26,16 +26,14 @@ public class SharePlugin extends Plugin {
26
26
 
27
27
  @Override
28
28
  public void load() {
29
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
30
- broadcastReceiver =
31
- new BroadcastReceiver() {
32
- @Override
33
- public void onReceive(Context context, Intent intent) {
34
- chosenComponent = intent.getParcelableExtra(Intent.EXTRA_CHOSEN_COMPONENT);
35
- }
36
- };
37
- getActivity().registerReceiver(broadcastReceiver, new IntentFilter(Intent.EXTRA_CHOSEN_COMPONENT));
38
- }
29
+ broadcastReceiver =
30
+ new BroadcastReceiver() {
31
+ @Override
32
+ public void onReceive(Context context, Intent intent) {
33
+ chosenComponent = intent.getParcelableExtra(Intent.EXTRA_CHOSEN_COMPONENT);
34
+ }
35
+ };
36
+ getActivity().registerReceiver(broadcastReceiver, new IntentFilter(Intent.EXTRA_CHOSEN_COMPONENT));
39
37
  }
40
38
 
41
39
  @ActivityCallback
@@ -100,7 +98,7 @@ public class SharePlugin extends Plugin {
100
98
  );
101
99
  intent.putExtra(Intent.EXTRA_STREAM, fileUrl);
102
100
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
103
- intent.setData(fileUrl);
101
+ intent.setDataAndType(fileUrl, type);
104
102
  }
105
103
  intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
106
104
  }
@@ -108,21 +106,15 @@ public class SharePlugin extends Plugin {
108
106
  if (title != null) {
109
107
  intent.putExtra(Intent.EXTRA_SUBJECT, title);
110
108
  }
111
-
112
- Intent chooser = null;
113
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
114
- // requestCode parameter is not used. Providing 0
115
- PendingIntent pi = PendingIntent.getBroadcast(
116
- getContext(),
117
- 0,
118
- new Intent(Intent.EXTRA_CHOSEN_COMPONENT),
119
- PendingIntent.FLAG_UPDATE_CURRENT
120
- );
121
- chooser = Intent.createChooser(intent, dialogTitle, pi.getIntentSender());
122
- chosenComponent = null;
123
- } else {
124
- chooser = Intent.createChooser(intent, dialogTitle);
109
+ int flags = PendingIntent.FLAG_UPDATE_CURRENT;
110
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
111
+ flags = flags | PendingIntent.FLAG_MUTABLE;
125
112
  }
113
+
114
+ // requestCode parameter is not used. Providing 0
115
+ PendingIntent pi = PendingIntent.getBroadcast(getContext(), 0, new Intent(Intent.EXTRA_CHOSEN_COMPONENT), flags);
116
+ Intent chooser = Intent.createChooser(intent, dialogTitle, pi.getIntentSender());
117
+ chosenComponent = null;
126
118
  chooser.addCategory(Intent.CATEGORY_DEFAULT);
127
119
  stopped = false;
128
120
  isPresenting = true;
@@ -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"]}
@@ -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"]}
@@ -1 +1 @@
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"}
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/share",
3
- "version": "1.1.0",
3
+ "version": "4.0.0-beta.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",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
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",
@@ -45,10 +45,10 @@
45
45
  "publish:cocoapod": "pod trunk push ./CapacitorShare.podspec --allow-warnings"
46
46
  },
47
47
  "devDependencies": {
48
- "@capacitor/android": "^3.0.0",
49
- "@capacitor/core": "^3.0.0",
48
+ "@capacitor/android": "next",
49
+ "@capacitor/core": "next",
50
50
  "@capacitor/docgen": "0.0.18",
51
- "@capacitor/ios": "^3.0.0",
51
+ "@capacitor/ios": "next",
52
52
  "@ionic/eslint-config": "^0.3.0",
53
53
  "@ionic/prettier-config": "~1.0.1",
54
54
  "@ionic/swiftlint-config": "^1.1.2",
@@ -61,7 +61,7 @@
61
61
  "typescript": "~4.1.5"
62
62
  },
63
63
  "peerDependencies": {
64
- "@capacitor/core": "^3.0.0"
64
+ "@capacitor/core": "next"
65
65
  },
66
66
  "prettier": "@ionic/prettier-config",
67
67
  "swiftlint": "@ionic/swiftlint-config",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "e5b333320426ee120d4504c68c02bd5538b21c51"
82
+ "gitHead": "fd7db8285f72990522da0adc889514c9804b6dae"
83
83
  }