@nativescript-community/ui-document-picker 1.1.7 → 1.1.11

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/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { FilePickerOptions, FolderPickerOptions } from './index.common';
2
+
3
+ export { FilePickerOptions, FolderPickerOptions };
4
+ export function openFilePicker(params?: FilePickerOptions): Promise<{ files: string[]; ios?; android? }>;
5
+ export function pickFolder(params?: FolderPickerOptions): Promise<{ folders: string[]; ios?; android? }>;
package/index.ios.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { FolderPickerOptions } from '.';
2
+ import { FilePickerOptions } from './index.common';
3
+ export { FilePickerOptions };
4
+ export declare function openFilePicker(params: FilePickerOptions): Promise<unknown>;
5
+ export declare function pickFolder(params?: FolderPickerOptions): Promise<{
6
+ folders: any[];
7
+ }>;
@@ -19,7 +19,7 @@ var DocumentPickerDelegate = /** @class */ (function (_super) {
19
19
  DocumentPickerDelegate.prototype.documentPickerDidPickDocumentAtURL = function (controller, url) {
20
20
  this._resolve({
21
21
  files: [url.absoluteString],
22
- ios: url,
22
+ ios: url
23
23
  });
24
24
  this.cleanup(controller);
25
25
  };
@@ -30,13 +30,13 @@ var DocumentPickerDelegate = /** @class */ (function (_super) {
30
30
  }
31
31
  this._resolve({
32
32
  files: output,
33
- ios: urls,
33
+ ios: urls
34
34
  });
35
35
  this.cleanup(controller);
36
36
  };
37
37
  DocumentPickerDelegate.prototype.documentPickerWasCancelled = function (controller) {
38
38
  this._resolve({
39
- files: [],
39
+ files: []
40
40
  });
41
41
  this.cleanup(controller);
42
42
  };
@@ -60,4 +60,9 @@ export function openFilePicker(params) {
60
60
  visibleVC.presentViewControllerAnimatedCompletion(controller, true, null);
61
61
  });
62
62
  }
63
- //# sourceMappingURL=filepicker.ios.js.map
63
+ export async function pickFolder(params = {}) {
64
+ return {
65
+ folders: []
66
+ };
67
+ }
68
+ //# sourceMappingURL=index.ios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CAAuC,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACP,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAA8B,EAAE;IAC7D,OAAO;QACH,OAAO,EAAE,EAAE;KACd,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,35 +1,45 @@
1
1
  {
2
- "name": "@nativescript-community/ui-document-picker",
3
- "version": "1.1.7",
4
- "description": "File Picker",
5
- "main": "./filepicker",
6
- "typings": "./filepicker.d.ts",
7
- "sideEffects": false,
8
- "nativescript": {
9
- "platforms": {
10
- "android": "3.0.0",
11
- "ios": "3.0.0"
12
- }
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/nativescript-community/ui-document-picker.git"
17
- },
18
- "keywords": [
19
- "ecosystem:NativeScript",
20
- "NativeScript"
21
- ],
22
- "author": {
23
- "name": "Martin Guillon",
24
- "email": "martin.guillon@akyasl.fr"
25
- },
26
- "license": "MIT",
27
- "bugs": {
28
- "url": "https://github.com/nativescript-community/ui-document-picker/issues"
29
- },
30
- "homepage": "https://github.com/nativescript-community/ui-document-picker",
31
- "dependencies": {
32
- "@nativescript-community/perms": "^2.1.0"
33
- },
34
- "gitHead": "40975088276c5aeeb0044ea49f1a2f4db11e7193"
2
+ "name": "@nativescript-community/ui-document-picker",
3
+ "version": "1.1.11",
4
+ "description": "A NativeScript plugin that allows you to select files from the device.",
5
+ "main": "index",
6
+ "typings": "index.d.ts",
7
+ "sideEffects": false,
8
+ "scripts": {
9
+ "build": "npm run tsc && npm run readme",
10
+ "readme": "../../node_modules/.bin/readme generate -c ../../tools/readme/blueprint.json",
11
+ "tsc": "../../node_modules/.bin/cpy '**/*.d.ts' '../../packages/ui-document-picker' --parents --cwd=../../src/ui-document-picker && ../../node_modules/.bin/tsc -skipLibCheck -d",
12
+ "clean": "../../node_modules/.bin/rimraf ./*.d.ts ./*.js ./*.js.map"
13
+ },
14
+ "nativescript": {
15
+ "platforms": {
16
+ "android": "6.0.0",
17
+ "ios": "6.0.0"
18
+ }
19
+ },
20
+ "keywords": [
21
+ "NativeScript",
22
+ "JavaScript",
23
+ "Android",
24
+ "iOS",
25
+ "vue",
26
+ "vue.js"
27
+ ],
28
+ "author": {
29
+ "name": "Martin Guillon",
30
+ "email": "martin@akylas.fr"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/nativescript-community/ui-document-picker/issues"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/nativescript-community/ui-document-picker"
38
+ },
39
+ "license": "Apache-2.0",
40
+ "readmeFilename": "README.md",
41
+ "dependencies": {
42
+ "@nativescript-community/perms": "2.2.2"
43
+ },
44
+ "gitHead": "a2f9a14ebc9433d513887ceb4a788458eb97dfb8"
35
45
  }
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+ </manifest>
@@ -0,0 +1,5 @@
1
+ dependencies {
2
+ // def storageVersion = project.hasProperty("storageVersion") ? project.storageVersion : "0.13.0"
3
+ // implementation "com.anggrayudi:storage:$storageVersion"
4
+
5
+ }
@@ -100,6 +100,8 @@ public class FilePath {
100
100
  if (cursor != null && cursor.moveToFirst()) {
101
101
  final int column_index = cursor.getColumnIndexOrThrow(column);
102
102
  return cursor.getString(column_index);
103
+ } else if (!cursor.moveToFirst()){
104
+ return getMediaStore(context, uri, null, null);
103
105
  }
104
106
  } finally {
105
107
  if (cursor != null)
@@ -207,6 +209,11 @@ public class FilePath {
207
209
  return fullPath;
208
210
  }
209
211
 
212
+ fullPath = "/storage/" + type + relativePath;
213
+ if (fileExists(fullPath)) {
214
+ return fullPath;
215
+ }
216
+
210
217
  return fullPath;
211
218
  }
212
219
 
@@ -225,6 +232,7 @@ public class FilePath {
225
232
 
226
233
  Log.d(TAG, "File - " +
227
234
  "Authority: " + uri.getAuthority() +
235
+ ", Path: " + uri.getPath() +
228
236
  ", Fragment: " + uri.getFragment() +
229
237
  ", Port: " + uri.getPort() +
230
238
  ", Query: " + uri.getQuery() +
@@ -260,7 +268,10 @@ public class FilePath {
260
268
  cursor = context.getContentResolver().query(uri, new String[]{MediaStore.MediaColumns.DISPLAY_NAME}, null, null, null);
261
269
  if (cursor != null && cursor.moveToFirst()) {
262
270
  String fileName = cursor.getString(0);
263
- String path = Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName;
271
+ String folders = android.os.Environment.getExternalStoragePublicDirectory(
272
+ android.os.Environment.DIRECTORY_DOWNLOADS
273
+ ).getAbsolutePath();
274
+ String path = folders + "/" + fileName;
264
275
  if (!TextUtils.isEmpty(path)) {
265
276
  return path;
266
277
  }
@@ -0,0 +1 @@
1
+ /// <reference path="./typings/android.d.ts" />