@react-native-documents/picker 10.1.0 → 10.1.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.
@@ -65,7 +65,8 @@ class MetadataGetter(private val uriMap: MutableMap<String, Uri>) {
65
65
  }
66
66
  }
67
67
 
68
- queryContentResolverMetadata(contentResolver, metadataBuilder, context)
68
+ val couldBeVirtualFile = pickOptions.allowVirtualFiles && DocumentsContract.isDocumentUri(context, sourceUri)
69
+ queryContentResolverMetadata(contentResolver, metadataBuilder, couldBeVirtualFile)
69
70
 
70
71
  metadataBuilder
71
72
  }
@@ -73,18 +74,24 @@ class MetadataGetter(private val uriMap: MutableMap<String, Uri>) {
73
74
  fun queryContentResolverMetadata(
74
75
  contentResolver: ContentResolver,
75
76
  metadataBuilder: DocumentMetadataBuilder,
76
- context: Context
77
+ couldBeVirtualFile: Boolean
77
78
  ) {
78
79
  val forUri = metadataBuilder.getUri()
80
+
81
+ val projection = mutableListOf(
82
+ DocumentsContract.Document.COLUMN_MIME_TYPE,
83
+ OpenableColumns.DISPLAY_NAME,
84
+ OpenableColumns.SIZE,
85
+ ).apply {
86
+ if (couldBeVirtualFile) {
87
+ add(DocumentsContract.Document.COLUMN_FLAGS)
88
+ }
89
+ }.toTypedArray()
90
+
79
91
  contentResolver
80
92
  .query(
81
93
  forUri,
82
- arrayOf(
83
- DocumentsContract.Document.COLUMN_MIME_TYPE,
84
- OpenableColumns.DISPLAY_NAME,
85
- OpenableColumns.SIZE,
86
- DocumentsContract.Document.COLUMN_FLAGS,
87
- ),
94
+ projection,
88
95
  null,
89
96
  null,
90
97
  null
@@ -106,7 +113,7 @@ class MetadataGetter(private val uriMap: MutableMap<String, Uri>) {
106
113
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
107
114
  // https://developer.android.com/training/data-storage/shared/documents-files#open-virtual-file
108
115
  val isVirtual =
109
- if (DocumentsContract.isDocumentUri(context, forUri)) {
116
+ if (couldBeVirtualFile) {
110
117
  val cursorValue: Int =
111
118
  getCursorValue(
112
119
  cursor, DocumentsContract.Document.COLUMN_FLAGS, Int::class.java
@@ -272,7 +272,7 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
272
272
  val targetUriString = if (options.hasKey("uri")) options.getString("uri") else null
273
273
 
274
274
  val metadataBuilder = fileOps.writeDocumentImpl(currentUriOfFileBeingExported, targetUriString, reactApplicationContext)
275
- metadataGetter.queryContentResolverMetadata(reactApplicationContext.contentResolver, metadataBuilder, reactApplicationContext)
275
+ metadataGetter.queryContentResolverMetadata(reactApplicationContext.contentResolver, metadataBuilder, couldBeVirtualFile = false)
276
276
 
277
277
  val arrayWithSingleResult = Arguments.createArray().apply {
278
278
  val resultMap = metadataBuilder.build()
@@ -6,7 +6,14 @@
6
6
  #import "RCTConvert+RNDocumentPicker.h"
7
7
  // this header file is generated by Xcode: https://developer.apple.com/documentation/swift/importing-swift-into-objective-c
8
8
  // if it cannot be found, try cleaning the build folder and Xcode derived data folder
9
+
10
+ // When using use_frameworks! :linkage => :static in Podfile
11
+ #if __has_include(<react_native_document_picker/react_native_document_picker-Swift.h>)
12
+ #import <react_native_document_picker/react_native_document_picker-Swift.h>
13
+ #else
9
14
  #import "react_native_document_picker-Swift.h"
15
+ #endif
16
+
10
17
  // for UIModalPresentationStyle conversion
11
18
  // remove after https://github.com/facebook/react-native/commit/2d547a3252b328251e49dabfeec85f8d46c85411 is released
12
19
  #import <React/RCTModalHostViewManager.h>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-documents/picker",
3
- "version": "10.1.0",
3
+ "version": "10.1.2",
4
4
  "description": "A react native interface to access documents from dropbox, google drive, iCloud...",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -50,7 +50,7 @@
50
50
  "url": "git+https://github.com/react-native-documents/document-picker.git"
51
51
  },
52
52
  "author": "Vojtech Novak (hello@react-native-training.eu)",
53
- "license": "see LICENSE file",
53
+ "license": "MIT",
54
54
  "bugs": {
55
55
  "url": "https://github.com/react-native-documents/document-picker/issues"
56
56
  },
@@ -21,10 +21,5 @@ Pod::Spec.new do |s|
21
21
  'DEFINES_MODULE' => 'YES',
22
22
  }
23
23
 
24
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
25
- # RN 71+
26
- install_modules_dependencies(s)
27
- else
28
- s.dependency "React-Core"
29
- end
24
+ install_modules_dependencies(s)
30
25
  end