@react-native-documents/picker 10.0.0 → 10.1.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.
@@ -40,13 +40,14 @@ class FileOperations(private val uriMap: MutableMap<String, Uri>) {
40
40
  val map = filesToCopy.getMap(i)
41
41
 
42
42
  try {
43
- val newFile = copySingleFile(map, context, destinationDir)
43
+ val nonNullMap = map ?: throw IllegalArgumentException("keepLocalCopy: The file argument is null at index $i")
44
+ val newFile = copySingleFile(nonNullMap, context, destinationDir)
44
45
  oneResult.merge(newFile)
45
46
  } catch (e: Exception) {
46
47
  val message: String = e.localizedMessage ?: e.message ?: "Unknown error"
47
48
  oneResult.putString("status", "error")
48
49
  oneResult.putString("copyError", message)
49
- oneResult.putString("sourceUri", map.getString("uri"))
50
+ oneResult.putString("sourceUri", map?.getString("uri"))
50
51
  }
51
52
  return@async oneResult
52
53
  }
@@ -180,18 +180,17 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
180
180
  val filesToCopy = options.getArray("files")
181
181
  val copyTo = options.getString("destination")
182
182
  if (copyTo == null || filesToCopy == null) {
183
- promise.reject("keepLocalCopy",
183
+ return promise.reject("keepLocalCopy",
184
184
  "You did not provide the correct options. Expected 'files' and 'destination', got: ${options.toHashMap().keys}"
185
185
  )
186
- } else {
187
- fileCopyingCoroutine.launch {
188
- val results = fileOps.copyFilesToLocalStorage(
189
- reactApplicationContext,
190
- filesToCopy,
191
- CopyDestination.fromPath(copyTo),
192
- )
193
- promise.resolve(results)
194
- }
186
+ }
187
+ fileCopyingCoroutine.launch {
188
+ val results = fileOps.copyFilesToLocalStorage(
189
+ reactApplicationContext,
190
+ filesToCopy,
191
+ CopyDestination.fromPath(copyTo),
192
+ )
193
+ promise.resolve(results)
195
194
  }
196
195
  }
197
196
 
@@ -7,7 +7,7 @@ class PromiseWrapper {
7
7
  private var promiseReject: RNDPPromiseRejectBlock?
8
8
  private var nameOfCallInProgress: String?
9
9
 
10
- private let E_DOCUMENT_PICKER_CANCELED = "E_DOCUMENT_PICKER_CANCELED"
10
+ private let E_DOCUMENT_PICKER_CANCELED = "OPERATION_CANCELED"
11
11
  private let ASYNC_OP_IN_PROGRESS = "ASYNC_OP_IN_PROGRESS"
12
12
 
13
13
  func setPromiseRejectingPrevious(_ resolve: @escaping RNDPPromiseResolveBlock,
@@ -1 +1 @@
1
- {"root":["../setup.ts"],"version":"5.6.3"}
1
+ {"root":["../setup.ts"],"version":"5.7.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-documents/picker",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
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",
@@ -26,8 +26,7 @@
26
26
  ],
27
27
  "scripts": {
28
28
  "build:mock": "tsc --build jest",
29
- "prepare": "bob build && yarn build:mock",
30
- "release": "yarn prepare && npx semantic-release"
29
+ "prepare": "bob build && yarn build:mock"
31
30
  },
32
31
  "codegenConfig": {
33
32
  "name": "rndocumentpickerCGen",
@@ -61,8 +60,8 @@
61
60
  },
62
61
  "devDependencies": {
63
62
  "@tsconfig/node18": "^18.2.4",
64
- "react-native-builder-bob": "^0.30.2",
65
- "typescript": "^5.6.2"
63
+ "react-native-builder-bob": "^0.36.0",
64
+ "typescript": "^5.7.3"
66
65
  },
67
66
  "peerDependencies": {
68
67
  "react": "*",
@@ -87,6 +86,5 @@
87
86
  }
88
87
  ]
89
88
  ]
90
- },
91
- "packageManager": "yarn@4.5.1"
89
+ }
92
90
  }