@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/CHANGELOG.md +53 -0
- package/LICENSE +201 -19
- package/README.md +118 -7
- package/index.android.d.ts +22 -0
- package/index.android.js +190 -0
- package/index.android.js.map +1 -0
- package/index.common.d.ts +16 -0
- package/index.common.js +2 -0
- package/index.common.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.ios.d.ts +7 -0
- package/{filepicker.ios.js → index.ios.js} +9 -4
- package/index.ios.js.map +1 -0
- package/package.json +43 -33
- package/platforms/android/AndroidManifest.xml +3 -0
- package/platforms/android/include.gradle +5 -0
- package/platforms/android/java/com/nativescript/documentpicker/FilePath.java +12 -1
- package/references.d.ts +1 -0
- package/typings/android.d.ts +1521 -0
- package/filepicker.android.d.ts +0 -12
- package/filepicker.android.js +0 -81
- package/filepicker.android.js.map +0 -1
- package/filepicker.common.d.ts +0 -5
- package/filepicker.common.js +0 -1
- package/filepicker.common.js.map +0 -1
- package/filepicker.d.ts +0 -4
- package/filepicker.ios.d.ts +0 -3
- package/filepicker.ios.js.map +0 -1
- package/platforms/android/ui_document_picker.aar +0 -0
- package/pnpm-lock.yaml +0 -10
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
|
-
|
63
|
+
export async function pickFolder(params = {}) {
|
64
|
+
return {
|
65
|
+
folders: []
|
66
|
+
};
|
67
|
+
}
|
68
|
+
//# sourceMappingURL=index.ios.js.map
|
package/index.ios.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"../src/","sources":["index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuD3C,IAAI,QAAQ,CAAC;AACb,MAAM,UAAU,cAAc,CAAC,MAAyB;IAEpD,IAAI,aAAa,CAAC;IAElB,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAA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
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"
|
33
|
-
|
34
|
-
|
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
|
}
|
@@ -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
|
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
|
}
|
package/references.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/// <reference path="./typings/android.d.ts" />
|