expo-document-picker 10.1.1 → 10.2.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,7 +10,28 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 10.1.1 — 2022-01-26
13
+ ## 10.2.0 — 2022-04-18
14
+
15
+ ### 💡 Others
16
+
17
+ - Updated `@expo/config-plugins` from `4.0.2` to `4.0.14` ([#15621](https://github.com/expo/expo/pull/15621) by [@EvanBacon](https://github.com/EvanBacon))
18
+
19
+ ### ⚠️ Notices
20
+
21
+ - 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))
22
+
23
+ ## 10.1.3 - 2022-02-09
24
+
25
+ _This version does not introduce any user-facing changes._
26
+
27
+ ## 10.1.2 - 2022-02-01
28
+
29
+ ### 🐛 Bug fixes
30
+
31
+ - 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))
32
+ - Handle nil MIME type. ([#16156](https://github.com/expo/expo/pull/16156) by [@brentvatne](https://github.com/brentvatne))
33
+
34
+ ## 10.1.1 - 2022-01-26
14
35
 
15
36
  ### 🐛 Bug fixes
16
37
 
package/README.md CHANGED
@@ -4,12 +4,12 @@ Provides access to the system's UI for selecting documents from the available pr
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/document-picker.md)
8
- - [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/document-picker/)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/document-picker.md)
8
+ - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/document-picker/)
9
9
 
10
10
  # Installation in managed Expo projects
11
11
 
12
- For managed [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/document-picker/).
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/document-picker/).
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.1'
6
+ version = '10.2.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 17
64
- versionName '10.1.1'
77
+ versionName '10.2.0'
65
78
  }
66
79
  lintOptions {
67
80
  abortOnError false
@@ -74,5 +87,5 @@ dependencies {
74
87
  api "androidx.annotation:annotation:1.0.0"
75
88
  api 'commons-io:commons-io:2.6'
76
89
 
77
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
90
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
78
91
  }
@@ -1,2 +1,3 @@
1
1
  declare const _default: import("expo-modules-core").ProxyNativeModule;
2
2
  export default _default;
3
+ //# sourceMappingURL=ExpoDocumentPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoDocumentPicker.d.ts","sourceRoot":"","sources":["../src/ExpoDocumentPicker.ts"],"names":[],"mappings":";AAEA,wBAAqD"}
@@ -4,3 +4,4 @@ declare const _default: {
4
4
  getDocumentAsync({ type, multiple, }: DocumentPickerOptions): Promise<DocumentResult>;
5
5
  };
6
6
  export default _default;
7
+ //# sourceMappingURL=ExpoDocumentPicker.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoDocumentPicker.web.d.ts","sourceRoot":"","sources":["../src/ExpoDocumentPicker.web.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;;;0CAU3D,qBAAqB,GAAG,QAAQ,cAAc,CAAC;;AARpD,wBA4DE"}
package/build/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export { DocumentPickerOptions, DocumentResult };
12
12
  * If the user cancelled the document picking, the promise resolves to `{ type: 'cancel' }`.
13
13
  */
14
14
  export declare function getDocumentAsync({ type, copyToCacheDirectory, multiple, }?: DocumentPickerOptions): Promise<DocumentResult>;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAAC;AAGjD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,IAAY,EACZ,oBAA2B,EAC3B,QAAgB,GACjB,GAAE,qBAA0B,GAAG,OAAO,CAAC,cAAc,CAAC,CAKtD"}
package/build/types.d.ts CHANGED
@@ -48,3 +48,4 @@ export declare type DocumentResult = {
48
48
  file?: File;
49
49
  output?: FileList | null;
50
50
  };
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,qBAAqB,GAAG;IAClC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF,oBAAY,cAAc,GACtB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B,CAAC"}
@@ -39,7 +39,7 @@
39
39
  static NSString * EXConvertMimeTypeToUTI(NSString *mimeType)
40
40
  {
41
41
  CFStringRef uti;
42
-
42
+
43
43
  // UTTypeCreatePreferredIdentifierForTag doesn't work with wildcard mimetypes
44
44
  // so support common top level types with wildcards here.
45
45
  if ([mimeType isEqualToString:@"*/*"]) {
@@ -56,7 +56,7 @@ static NSString * EXConvertMimeTypeToUTI(NSString *mimeType)
56
56
  CFStringRef mimeTypeRef = (__bridge CFStringRef)mimeType;
57
57
  uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeTypeRef, NULL);
58
58
  }
59
-
59
+
60
60
  return (__bridge_transfer NSString *)uti;
61
61
  }
62
62
 
@@ -80,7 +80,7 @@ EX_EXPORT_MODULE(ExpoDocumentPicker);
80
80
  - (void)setModuleRegistry:(EXModuleRegistry *)moduleRegistry
81
81
  {
82
82
  _moduleRegistry = moduleRegistry;
83
-
83
+
84
84
  if (_moduleRegistry != nil) {
85
85
  _fileSystem = [moduleRegistry getModuleImplementingProtocol:@protocol(EXFileSystemInterface)];
86
86
  _utilities = [moduleRegistry getModuleImplementingProtocol:@protocol(EXUtilitiesInterface)];
@@ -97,7 +97,7 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
97
97
  }
98
98
  _resolve = resolve;
99
99
  _reject = reject;
100
-
100
+
101
101
  NSArray *mimeTypes = options[@"type"] ?: @[@"*/*"];
102
102
  if (mimeTypes.count == 0) {
103
103
  reject(@"E_DOCUMENT_PICKER", @"type must be a list of strings.", nil);
@@ -136,7 +136,7 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
136
136
  #endif
137
137
  }
138
138
  @catch (NSException *exception) {
139
- reject(@"E_PICKER_ICLOUD", @"DocumentPicker requires the iCloud entitlement. If you are using ExpoKit, you need to add this capability to your App Id. See `https://docs.expo.io/versions/latest/expokit/advanced-expokit-topics#using-documentpicker` for more info.", nil);
139
+ reject(@"E_PICKER_ICLOUD", @"DocumentPicker requires the iCloud entitlement. If you are using ExpoKit, you need to add this capability to your App Id. See `https://docs.expo.dev/versions/latest/expokit/advanced-expokit-topics#using-documentpicker` for more info.", nil);
140
140
  self->_resolve = nil;
141
141
  self->_reject = nil;
142
142
  return;
@@ -165,7 +165,7 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
165
165
  _reject = nil;
166
166
  return;
167
167
  }
168
-
168
+
169
169
  NSURL *newUrl = url;
170
170
  if (_shouldCopyToCacheDirectory) {
171
171
  if (!_fileSystem) {
@@ -183,17 +183,23 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
183
183
  return;
184
184
  }
185
185
  }
186
-
186
+
187
187
  NSString *extension = [url pathExtension];
188
188
  NSString *mimeType = [EXDocumentPickerModule getMimeType:extension];
189
-
190
- _resolve(@{
191
- @"type": @"success",
192
- @"uri": [newUrl absoluteString],
193
- @"name": [url lastPathComponent],
194
- @"size": @(fileSize),
195
- @"mimeType": mimeType
196
- });
189
+
190
+ NSMutableDictionary *response = [@{
191
+ @"type": @"success",
192
+ @"uri": [newUrl absoluteString],
193
+ @"name": [url lastPathComponent],
194
+ @"size": @(fileSize)
195
+ } mutableCopy];
196
+
197
+ if (mimeType != nil) {
198
+ response[@"mimeType"] = mimeType;
199
+ }
200
+
201
+ _resolve(response);
202
+
197
203
  _resolve = nil;
198
204
  _reject = nil;
199
205
  }
@@ -218,17 +224,17 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
218
224
  if (*error) {
219
225
  return 0;
220
226
  }
221
-
227
+
222
228
  if (fileAttributes.fileType != NSFileTypeDirectory) {
223
229
  return fileAttributes.fileSize;
224
230
  }
225
-
231
+
226
232
  // The path is pointing to the folder
227
233
  NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:error];
228
234
  if (*error) {
229
235
  return 0;
230
236
  }
231
-
237
+
232
238
  NSEnumerator *contentsEnumurator = [contents objectEnumerator];
233
239
  NSString *file;
234
240
  unsigned long long folderSize = 0;
@@ -238,7 +244,7 @@ EX_EXPORT_METHOD_AS(getDocumentAsync,
238
244
  return 0;
239
245
  }
240
246
  }
241
-
247
+
242
248
  return folderSize;
243
249
  }
244
250
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-document-picker",
3
- "version": "10.1.1",
3
+ "version": "10.2.0",
4
4
  "description": "Provides access to the system's UI for selecting documents from the available providers on the user's device.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "preset": "expo-module-scripts"
36
36
  },
37
37
  "dependencies": {
38
- "@expo/config-plugins": "^4.0.2",
38
+ "@expo/config-plugins": "^4.0.14",
39
39
  "uuid": "^3.3.2"
40
40
  },
41
41
  "devDependencies": {
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "expo": "*"
46
46
  },
47
- "gitHead": "1180c9614cadfcc09160e915ec2de147c6f10fc2"
47
+ "gitHead": "22dce752354bb429c84851bc4389abe47a766b1f"
48
48
  }