expo-sharing 10.1.0 → 10.3.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
@@ -10,6 +10,24 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 10.3.0 — 2022-07-07
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Changed the return type of the `shareAsync` function. The promise now resolves to `void` instead of an empty object. ([#18019](https://github.com/expo/expo/pull/18019) by [@barthap](https://github.com/barthap))
18
+
19
+ ## 10.2.0 — 2022-04-18
20
+
21
+ ### ⚠️ Notices
22
+
23
+ - On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
24
+
25
+ ## 10.1.1 - 2022-02-01
26
+
27
+ ### 🐛 Bug fixes
28
+
29
+ - Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
30
+
13
31
  ## 10.1.0 — 2021-12-03
14
32
 
15
33
  _This version does not introduce any user-facing changes._
package/README.md CHANGED
@@ -4,12 +4,12 @@ Sharing standalone module
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/sharing.md)
8
- - [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/sharing/)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/sharing.md)
8
+ - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/sharing/)
9
9
 
10
10
  # Installation in managed Expo projects
11
11
 
12
- For [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/sharing/).
12
+ For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/sharing/).
13
13
 
14
14
  # Installation in bare React Native projects
15
15
 
@@ -1,67 +1,80 @@
1
1
  apply plugin: 'com.android.library'
2
2
  apply plugin: 'kotlin-android'
3
- apply plugin: 'maven'
3
+ apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '10.1.0'
6
+ version = '10.3.0'
7
7
 
8
8
  buildscript {
9
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
+ if (expoModulesCorePlugin.exists()) {
11
+ apply from: expoModulesCorePlugin
12
+ applyKotlinExpoModulesCorePlugin()
13
+ }
14
+
9
15
  // Simple helper that allows the root project to override versions declared by this library.
10
16
  ext.safeExtGet = { prop, fallback ->
11
17
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
12
18
  }
13
19
 
20
+ // Ensures backward compatibility
21
+ ext.getKotlinVersion = {
22
+ if (ext.has("kotlinVersion")) {
23
+ ext.kotlinVersion()
24
+ } else {
25
+ ext.safeExtGet("kotlinVersion", "1.6.10")
26
+ }
27
+ }
28
+
14
29
  repositories {
15
30
  mavenCentral()
16
31
  }
17
32
 
18
33
  dependencies {
19
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.4.21')}")
34
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
20
35
  }
21
36
  }
22
37
 
23
- // Upload android library to maven with javadoc and android sources
24
- configurations {
25
- deployerJars
26
- }
27
-
28
38
  // Creating sources with comments
29
39
  task androidSourcesJar(type: Jar) {
30
40
  classifier = 'sources'
31
41
  from android.sourceSets.main.java.srcDirs
32
42
  }
33
43
 
34
- // Put the androidSources and javadoc to the artifacts
35
- artifacts {
36
- archives androidSourcesJar
37
- }
38
-
39
- uploadArchives {
40
- repositories {
41
- mavenDeployer {
42
- configuration = configurations.deployerJars
43
- repository(url: mavenLocal().url)
44
+ afterEvaluate {
45
+ publishing {
46
+ publications {
47
+ release(MavenPublication) {
48
+ from components.release
49
+ // Add additional sourcesJar to artifacts
50
+ artifact(androidSourcesJar)
51
+ }
52
+ }
53
+ repositories {
54
+ maven {
55
+ url = mavenLocal().url
56
+ }
44
57
  }
45
58
  }
46
59
  }
47
60
 
48
61
  android {
49
- compileSdkVersion safeExtGet("compileSdkVersion", 30)
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 31)
50
63
 
51
64
  compileOptions {
52
- sourceCompatibility JavaVersion.VERSION_1_8
53
- targetCompatibility JavaVersion.VERSION_1_8
65
+ sourceCompatibility JavaVersion.VERSION_11
66
+ targetCompatibility JavaVersion.VERSION_11
54
67
  }
55
68
 
56
69
  kotlinOptions {
57
- jvmTarget = JavaVersion.VERSION_1_8
70
+ jvmTarget = JavaVersion.VERSION_11.majorVersion
58
71
  }
59
72
 
60
73
  defaultConfig {
61
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
62
- targetSdkVersion safeExtGet("targetSdkVersion", 30)
75
+ targetSdkVersion safeExtGet("targetSdkVersion", 31)
63
76
  versionCode 16
64
- versionName '10.1.0'
77
+ versionName '10.3.0'
65
78
  }
66
79
  lintOptions {
67
80
  abortOnError false
@@ -73,5 +86,5 @@ dependencies {
73
86
 
74
87
  api "androidx.legacy:legacy-support-v4:1.0.0"
75
88
 
76
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
89
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
77
90
  }
@@ -5,7 +5,6 @@ import android.content.Context
5
5
  import android.content.Intent
6
6
  import android.content.pm.PackageManager
7
7
  import android.net.Uri
8
- import android.os.Bundle
9
8
  import androidx.core.content.FileProvider
10
9
  import expo.modules.core.ExportedModule
11
10
  import expo.modules.core.ModuleRegistry
@@ -111,7 +110,7 @@ class SharingModule(
111
110
 
112
111
  override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
113
112
  if (requestCode == REQUEST_CODE && pendingPromise != null) {
114
- pendingPromise?.resolve(Bundle.EMPTY)
113
+ pendingPromise?.resolve(null)
115
114
  pendingPromise = null
116
115
  }
117
116
  }
@@ -1,2 +1,3 @@
1
1
  declare const _default: import("expo-modules-core").ProxyNativeModule;
2
2
  export default _default;
3
+ //# sourceMappingURL=ExpoSharing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSharing.d.ts","sourceRoot":"","sources":["../src/ExpoSharing.ts"],"names":[],"mappings":";AAEA,wBAA8C"}
@@ -9,3 +9,4 @@ declare const _default: {
9
9
  shareAsync(url: string, options?: ShareOptions): Promise<void>;
10
10
  };
11
11
  export default _default;
12
+ //# sourceMappingURL=ExpoSharing.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSharing.web.d.ts","sourceRoot":"","sources":["../src/ExpoSharing.web.ts"],"names":[],"mappings":"AAEA,aAAK,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;;;wBAMxC,QAAQ,OAAO,CAAC;oBAOpB,MAAM,YAAW,YAAY,GAAQ,QAAQ,IAAI,CAAC;;AAX1E,wBAmBE"}
@@ -1,15 +1,19 @@
1
1
  export declare type SharingOptions = {
2
2
  /**
3
- * Sets `mimeType` for `Intent` *(Android only)*
3
+ * Sets `mimeType` for `Intent`.
4
+ * @platform android
4
5
  */
5
6
  mimeType?: string;
6
7
  /**
7
- * ([Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html))
8
- * the type of the target file *(iOS only)*
8
+ * [Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)
9
+ * - the type of the target file.
10
+ * @platform ios
9
11
  */
10
12
  UTI?: string;
11
13
  /**
12
- * Sets share dialog title *(Android and Web only)*
14
+ * Sets share dialog title.
15
+ * @platform android
16
+ * @platform web
13
17
  */
14
18
  dialogTitle?: string;
15
19
  };
@@ -23,4 +27,5 @@ export declare function isAvailableAsync(): Promise<boolean>;
23
27
  * @param url Local file URL to share.
24
28
  * @param options A map of share options.
25
29
  */
26
- export declare function shareAsync(url: string, options?: SharingOptions): Promise<object>;
30
+ export declare function shareAsync(url: string, options?: SharingOptions): Promise<void>;
31
+ //# sourceMappingURL=Sharing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sharing.d.ts","sourceRoot":"","sources":["../src/Sharing.ts"],"names":[],"mappings":"AAKA,oBAAY,cAAc,GAAG;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CASzD;AAGD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Sharing.js","sourceRoot":"","sources":["../src/Sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,OAAO,MAAM,eAAe,CAAC;AAmBpC,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,OAAO,EAAE;QACX,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,OAAO,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;SACzC;QACD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,UAA0B,EAAE;IACxE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACnC,MAAM,IAAI,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;KACxD;IACD,OAAO,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport Sharing from './ExpoSharing';\n\n// @needsAudit\nexport type SharingOptions = {\n /**\n * Sets `mimeType` for `Intent` *(Android only)*\n */\n mimeType?: string;\n /**\n * ([Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html))\n * the type of the target file *(iOS only)*\n */\n UTI?: string;\n /**\n * Sets share dialog title *(Android and Web only)*\n */\n dialogTitle?: string;\n};\n\n// @needsAudit\n/**\n * Determine if the sharing API can be used in this app.\n * @return A promise that fulfills with `true` if the sharing API can be used, and `false` otherwise.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (Sharing) {\n if (Sharing.isAvailableAsync) {\n return await Sharing.isAvailableAsync();\n }\n return true;\n }\n\n return false;\n}\n\n// @needsAudit\n/**\n * Opens action sheet to share file to different applications which can handle this type of file.\n * @param url Local file URL to share.\n * @param options A map of share options.\n */\nexport async function shareAsync(url: string, options: SharingOptions = {}): Promise<object> {\n if (!Sharing || !Sharing.shareAsync) {\n throw new UnavailabilityError('Sharing', 'shareAsync');\n }\n return await Sharing.shareAsync(url, options);\n}\n"]}
1
+ {"version":3,"file":"Sharing.js","sourceRoot":"","sources":["../src/Sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,OAAO,MAAM,eAAe,CAAC;AAuBpC,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,OAAO,EAAE;QACX,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,OAAO,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;SACzC;QACD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,UAA0B,EAAE;IACxE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACnC,MAAM,IAAI,mBAAmB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;KACxD;IACD,OAAO,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport Sharing from './ExpoSharing';\n\n// @needsAudit\nexport type SharingOptions = {\n /**\n * Sets `mimeType` for `Intent`.\n * @platform android\n */\n mimeType?: string;\n /**\n * [Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)\n * - the type of the target file.\n * @platform ios\n */\n UTI?: string;\n /**\n * Sets share dialog title.\n * @platform android\n * @platform web\n */\n dialogTitle?: string;\n};\n\n// @needsAudit\n/**\n * Determine if the sharing API can be used in this app.\n * @return A promise that fulfills with `true` if the sharing API can be used, and `false` otherwise.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (Sharing) {\n if (Sharing.isAvailableAsync) {\n return await Sharing.isAvailableAsync();\n }\n return true;\n }\n\n return false;\n}\n\n// @needsAudit\n/**\n * Opens action sheet to share file to different applications which can handle this type of file.\n * @param url Local file URL to share.\n * @param options A map of share options.\n */\nexport async function shareAsync(url: string, options: SharingOptions = {}): Promise<void> {\n if (!Sharing || !Sharing.shareAsync) {\n throw new UnavailabilityError('Sharing', 'shareAsync');\n }\n return await Sharing.shareAsync(url, options);\n}\n"]}
@@ -65,7 +65,7 @@ EX_EXPORT_METHOD_AS(shareAsync,
65
65
 
66
66
  - (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller
67
67
  {
68
- _pendingResolver(@{});
68
+ _pendingResolver(nil);
69
69
  _pendingResolver = nil;
70
70
 
71
71
  _documentInteractionController = nil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-sharing",
3
- "version": "10.1.0",
3
+ "version": "10.3.0",
4
4
  "description": "ExpoSharing standalone module",
5
5
  "main": "build/Sharing.js",
6
6
  "types": "build/Sharing.d.ts",
@@ -37,5 +37,5 @@
37
37
  "peerDependencies": {
38
38
  "expo": "*"
39
39
  },
40
- "gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
40
+ "gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
41
41
  }
package/src/Sharing.ts CHANGED
@@ -5,16 +5,20 @@ import Sharing from './ExpoSharing';
5
5
  // @needsAudit
6
6
  export type SharingOptions = {
7
7
  /**
8
- * Sets `mimeType` for `Intent` *(Android only)*
8
+ * Sets `mimeType` for `Intent`.
9
+ * @platform android
9
10
  */
10
11
  mimeType?: string;
11
12
  /**
12
- * ([Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html))
13
- * the type of the target file *(iOS only)*
13
+ * [Uniform Type Identifier](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)
14
+ * - the type of the target file.
15
+ * @platform ios
14
16
  */
15
17
  UTI?: string;
16
18
  /**
17
- * Sets share dialog title *(Android and Web only)*
19
+ * Sets share dialog title.
20
+ * @platform android
21
+ * @platform web
18
22
  */
19
23
  dialogTitle?: string;
20
24
  };
@@ -41,7 +45,7 @@ export async function isAvailableAsync(): Promise<boolean> {
41
45
  * @param url Local file URL to share.
42
46
  * @param options A map of share options.
43
47
  */
44
- export async function shareAsync(url: string, options: SharingOptions = {}): Promise<object> {
48
+ export async function shareAsync(url: string, options: SharingOptions = {}): Promise<void> {
45
49
  if (!Sharing || !Sharing.shareAsync) {
46
50
  throw new UnavailabilityError('Sharing', 'shareAsync');
47
51
  }
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "./build"
6
6
  },
7
7
  "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__stories__/*"]
9
9
  }