diff --git a/packages/ui-document-picker/README.md b/packages/ui-document-picker/README.md
index 1a271d9..4cdff35 100644
--- a/packages/ui-document-picker/README.md
+++ b/packages/ui-document-picker/README.md
@@ -43,9 +43,15 @@
* [Vue](#vue)
* [Examples](#examples)
* [Demos and Development](#demos-and-development)
- * [Setup](#setup)
+ * [Repo Setup](#repo-setup)
* [Build](#build)
* [Demos](#demos)
+* [Contributing](#contributing)
+ * [Update repo ](#update-repo-)
+ * [Update readme ](#update-readme-)
+ * [Update doc ](#update-doc-)
+ * [Publish](#publish)
+ * [modifying submodules](#modifying-submodules)
* [Questions](#questions)
@@ -93,18 +99,18 @@ export function openFilePicker(params: FilePickerOptions): Promise<{ files: stri
## Demos and Development
-### Setup
-
-To run the demos, you must clone this repo **recursively**.
+### Repo Setup
+The repo uses submodules. If you did not clone with ` --recursive` then you need to call
```
-git clone https://github.com/@nativescript-community/ui-document-picker.git --recursive
+git submodule update --init
```
-**Install Dependencies:**
-```bash
-npm i # or 'yarn install' or 'pnpm install'
-```
+The package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.
+
+To develop and test:
+if you use `yarn` then run `yarn`
+if you use `pnpm` then run `pnpm i`
**Interactive Menu:**
@@ -113,10 +119,9 @@ To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`)
### Build
```bash
-npm run build
-
-npm run build.angular # or for Angular
+npm run build.all
```
+WARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run`
### Demos
@@ -125,6 +130,61 @@ npm run demo.[ng|react|svelte|vue].[ios|android]
npm run demo.svelte.ios # Example
```
+
+Demo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]`
+Instead you work in `demo-snippets/[ng|react|svelte|vue]`
+You can start from the `install.ts` of each flavor to see how to register new demos
+
+
+[](#contributing)
+
+## Contributing
+
+### Update repo
+
+You can update the repo files quite easily
+
+First update the submodules
+
+```bash
+npm run update
+```
+
+Then commit the changes
+Then update common files
+
+```bash
+npm run sync
+```
+Then you can run `yarn|pnpm`, commit changed files if any
+
+### Update readme
+```bash
+npm run readme
+```
+
+### Update doc
+```bash
+npm run doc
+```
+
+### Publish
+
+The publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)
+Simply run
+```shell
+npm run publish
+```
+
+### modifying submodules
+
+The repo uses https:// for submodules which means you won't be able to push directly into the submodules.
+One easy solution is t modify `~/.gitconfig` and add
+```
+[url "ssh://git@github.com/"]
+ pushInsteadOf = https://github.com/
+```
+
[](#questions)
diff --git a/packages/ui-document-picker/package.json b/packages/ui-document-picker/package.json
index 76be36e..060c9fa 100644
--- a/packages/ui-document-picker/package.json
+++ b/packages/ui-document-picker/package.json
@@ -39,6 +39,6 @@
"license": "Apache-2.0",
"readmeFilename": "README.md",
"dependencies": {
- "@nativescript-community/perms": "2.2.5"
+ "@nativescript-community/perms": "^2.3.0"
}
}
diff --git a/packages/ui-document-picker/tsconfig.json b/packages/ui-document-picker/tsconfig.json
index 21d8fb6..a85dd44 100644
--- a/packages/ui-document-picker/tsconfig.json
+++ b/packages/ui-document-picker/tsconfig.json
@@ -8,6 +8,6 @@
"tns-core-modules/*": ["./node_modules/@nativescript/core/*"]
}
},
- "include": ["../../src/ui-document-picker/**/*.ts", "../../references.d.ts", "../../src/references.d.ts"],
+ "include": ["../../src/ui-document-picker/**/*.ts", "../../references.d.ts", "../../tools/references.d.ts", "../../src/references.d.ts"],
"exclude": ["../../src/ui-document-picker/angular/**"]
}
diff --git a/src/ui-document-picker/index.android.ts b/src/ui-document-picker/index.android.ts
index daac37b..95943cd 100644
--- a/src/ui-document-picker/index.android.ts
+++ b/src/ui-document-picker/index.android.ts
@@ -1,6 +1,5 @@
import { request } from '@nativescript-community/perms';
-import { AndroidActivityResultEventData, android as androidApp } from '@nativescript/core/application';
-import { AndroidApplication, Device } from '@nativescript/core';
+import { AndroidActivityResultEventData, AndroidApplication, Application, Device } from '@nativescript/core';
import lazy from '@nativescript/core/utils/lazy';
import { CommonPickerOptions, FilePickerOptions, FolderPickerOptions } from './index.common';
@@ -16,10 +15,10 @@ async function callIntent(context, intent, pickerType) {
const onEvent = function (e: AndroidActivityResultEventData) {
if (e.requestCode === pickerType) {
resolve(e);
- androidApp.off(AndroidApplication.activityResultEvent, onEvent);
+ Application.android.off(AndroidApplication.activityResultEvent, onEvent);
}
};
- androidApp.once(AndroidApplication.activityResultEvent, onEvent);
+ Application.android.once(AndroidApplication.activityResultEvent, onEvent);
context.startActivityForResult(intent, pickerType);
});
}
@@ -63,7 +62,7 @@ function prepareIntent(intent: android.content.Intent, options: CommonPickerOpti
}
export function openFilePicker(params: FilePickerOptions = {}) {
- const context = androidApp.foregroundActivity || androidApp.startActivity;
+ const context = Application.android.foregroundActivity || Application.android.startActivity;
const FILE_CODE = 1231;
if (!Intent) {
@@ -157,7 +156,7 @@ function updatePersistableUris(context: android.content.Context, uri: android.ne
}
}
export function pickFolder(params: FolderPickerOptions = {}) {
- const context = androidApp.foregroundActivity || androidApp.startActivity;
+ const context = Application.android.foregroundActivity || Application.android.startActivity;
const FOLDER_CODE = 1232;
if (!Intent) {
Intent = android.content.Intent;
diff --git a/src/ui-document-picker/index.ios.ts b/src/ui-document-picker/index.ios.ts
index 78f8c4d..b6deb72 100644
--- a/src/ui-document-picker/index.ios.ts
+++ b/src/ui-document-picker/index.ios.ts
@@ -61,7 +61,7 @@ export function openFilePicker(params: FilePickerOptions = {}) {
if (params.extensions && params.extensions.length > 0) {
documentTypes = Utils.ios.collections.jsArrayToNSArray(params.extensions);
} else {
- documentTypes = Utils.ios.collections.jsArrayToNSArray([kUTTypeContent]);
+ documentTypes = Utils.ios.collections.jsArrayToNSArray([UTTypeContent.identifier]);
}
return new Promise((resolve, reject) => {
diff --git a/src/ui-document-picker/references.d.ts b/src/ui-document-picker/references.d.ts
index 13665dc..909f74d 100644
--- a/src/ui-document-picker/references.d.ts
+++ b/src/ui-document-picker/references.d.ts
@@ -1 +1,3 @@
///
+///
+///