Skip to content

Commit e3d30b2

Browse files
committed
docs: update
1 parent 09c0e5a commit e3d30b2

File tree

3 files changed

+45
-27
lines changed

3 files changed

+45
-27
lines changed

packages/nativescript-custom-rotors/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ The `nativescript-custom-rotors` adds easy to use properties to common {N} views
2121
## Installation
2222

2323
```bash
24-
npm install @voicethread/nativescript-custom-rotors
24+
npm install @voicethread/nativescript-custom-rotors --save
2525
```
26+
OR
27+
```bash
28+
ns plugin install @voicethread/nativescript-custom-rotors
2629

2730
## Expanded Classes
2831

packages/nativescript-downloader/README.md

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# NativeScript Downloader ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png)![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png)
2-
3-
[![npm](https://img.shields.io/npm/v/@voicethread/nativescript-downloader?style=flat-square)](https://www.npmjs.com/package/@voicethread/nativescript-downloader)
1+
# NativeScript Downloader [![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png)]() [![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png)]()[![npm](https://img.shields.io/npm/v/@voicethread/nativescript-downloader?style=flat-square)](https://www.npmjs.com/package/@voicethread/nativescript-downloader)
42

53
> @voicethread/nativescript-downloader
64
@@ -14,30 +12,34 @@ https://github.com/VoiceThread/nativescript-plugins/assets/20136906/80d40e3f-2c4
1412

1513
## Contents
1614

17-
- [NativeScript Downloader android](#nativescript-downloader-android)
15+
- [NativeScript Downloader](#nativescript-downloader)
1816
- [Contents](#contents)
1917
- [Installation](#installation)
2018
- [Usage](#usage)
2119
- [Supported Downloader Options](#supported-downloader-options)
22-
- [Android Specifics](#android-specifics)
23-
- [iOS Specifics](#ios-specifics)
20+
- [Android Specifics](#android-specifics)
21+
- [iOS Specifics](#ios-specifics)
2422
- [Acknowledgements](#acknowledgements)
2523
- [License](#license)
2624

2725
## Installation
2826

2927
```bash
30-
npm install @voicethread/nativescript-downloader
28+
npm install @voicethread/nativescript-downloader --save
29+
```
30+
OR
31+
```bash
32+
ns plugin add @voicethread/nativescript-downloader
3133
```
3234

3335
## Usage
3436

35-
The best way to understand how to use the plugin is to study the demo app included in this repo. You can see plugin being used in a TypeScript application by looking at `apps/demo/src/plugin-demos/downloader.ts`.
37+
The best way to understand how to use the plugin is to study the demo app included in this repo. You can see how the plugin is used in a TypeScript application page by looking at `apps/demo/src/plugin-demos/nativescript-downloader.ts`.
3638

3739
1. Import the plugin.
3840

3941
```javascript
40-
import { DownloadDestination, Downloader, DownloadOptions, MessageData } from '@voicethread/nativescript-downloader';
42+
import { Downloader, DownloadOptions, MessageData } from '@voicethread/nativescript-downloader';
4143
```
4244

4345
2. Create a downloader instance.
@@ -46,7 +48,13 @@ import { DownloadDestination, Downloader, DownloadOptions, MessageData } from '@
4648
const dp = new Downloader();
4749
```
4850

49-
3. The only required option is the URL to be downloaded. You can also pass other options as listed in DownloadOptions before starting the download. You can listen to events emitted by the download during operation in case you want to update a download status message/indicator or handle an error. Upon success, the plugin will return a File reference to the downloaded file located in the app cache directory for Android and the app document's directory for iOS, which can then be used directly by the dev without extra permissions for any other operations on the file.
51+
3. Download a file.
52+
```javascript
53+
const dlfile = await dp.download({ url: 'https://some.domain.com/file.txt' });
54+
```
55+
The only required option is the URL to be downloaded. You can also pass other options as listed in [DownloadOptions](#supported-downloader-options) below before starting the download.
56+
57+
You can listen to events emitted by the download during operation in case you want to update a download status message/indicator or handle an error. Upon success, the plugin will return a File reference to the downloaded file located in the app cache directory for Android and the app document's directory for iOS, which can then be used directly by the dev without extra permissions for any other operations on the file.
5058

5159
```javascript
5260
dp.on(Downloader.DOWNLOAD_STARTED, (payload: MessageData) => {
@@ -77,9 +85,9 @@ interface DownloadOptions {
7785
request?: RequestOptions; //request header strings to be passed to the https connection
7886
destinationPath?: string; //must be a valid path for app to create a new file (existing directory with valid filename)
7987
destinationFilename?: string; //must be a string like XXXX[].[YYYYYY] without any path preceding
80-
copyPicker?: boolean; //present user with UI to choose destination directory
81-
copyGallery?: boolean; //iOS only, if download has a recognized image/video file name extension, saved to iOS Photos, ignored on Android
82-
copyDownloads?: boolean; //Android only, uses legacy DIRECTORY_DOWNLOADS, or MediaStore for 29+
88+
copyPicker?: boolean; //present user with UI to choose destination directory to save a copy of download
89+
copyGallery?: boolean; //iOS only, if download has a recognized image/video file name extension, save a copy to iOS Photos, ignored on Android
90+
copyDownloads?: boolean; //Android only, adds a copy to device Downloads directory using legacy DIRECTORY_DOWNLOADS, or MediaStore for 29+
8391
notification?: boolean; //Android-only. Show system notification for download success/failure. defaults to false
8492
}
8593
```
@@ -100,8 +108,11 @@ By default, the plugin disabled Android system notifications of downloads, which
100108
101109
You can choose to enable these notifications which will show the user progress and completion/failure notifications.
102110
103-
Android version of the plugin supports two destination copy approaches. First, `copyPicker` will first download the file to the default cache directory, and then present the user with a picker UI so that they select where they'd like a copy saved. This approach avoids permission requirements since the user is involved in the destination choice.
104-
Second, `copyDownloads` will save a copy to the device's Download directory in case the user wants to use that file in another application from an easy to find location. API versions > 28 use MediaStore, and no extra permissions are necessary. For API versions 28 and below, you'll need to ensure you have Android Manifest permissions defined using:
111+
Android version of the plugin supports two destination copy approaches:
112+
113+
1. `copyPicker` will first download the file to the default cache directory, and then present the user with a picker UI so that they select where they'd like a copy saved. This approach avoids permission requirements since the user is involved in the destination choice.
114+
115+
2. `copyDownloads` will save a copy to the device's Download directory in case the user wants to use that file in another application from an easy to find location. API versions > 28 use MediaStore, and no extra permissions are necessary. For API versions 28 and below, you'll need to ensure you have Android Manifest permissions defined using:
105116
106117
```xml
107118
<manifest ... >
@@ -113,20 +124,21 @@ Second, `copyDownloads` will save a copy to the device's Download directory in c
113124
114125
iOS applications will download files by default to the application's documents directory, which is defined in Nativescript as `knownFolders.documents()` and does not require any extra permissions from the user. This also has the advantage of being the location where an application can make downloaded files visible to other apps once it has been configured as a document provider.
115126
116-
The iOS version of the plugin supports two destination copy approaches. First, `copyPicker` will first download the file to the application documents directory, and then present the user with a picker UI so that they can select where they'd like a copy saved. This approach avoids permission requirements since the user is involved in the destination choice. Note: This is only available on iOS 13+
127+
The iOS version of the plugin supports two destination copy approaches:
128+
1. `copyPicker` will first download the file to the application documents directory, and then present the user with a picker UI so that they can select where they'd like a copy saved. This approach avoids permission requirements since the user is involved in the destination choice. Note: This is only available on iOS 13+
117129
118-
Second, `copyGallery` will save a copy to the device's Photos Gallery in case the user wants to use that file in another application from an easy to find location. This approach requires the user to grant photo library permission first in order to save the downloaded file. Your app might be rejected from the Apple App Store if you do not provide a description about why you need this permission. The default message "Requires access to photo library." might not be enough for the App Store reviewers. You can customize it by editing the `app/App_Resources/iOS/Info.plist` file in your app and adding something like the following:
130+
2. `copyGallery` will save a copy to the device's Photos Gallery in case the user wants to use that file in another application from an easy to find location. This approach requires the user to grant photo library permission first in order to save the downloaded file. Your app might be rejected from the Apple App Store if you do not provide a description about why you need this permission. The default message "Requires access to photo library." might not be enough for the App Store reviewers. You can customize it by editing the `app/App_Resources/iOS/Info.plist` file in your app and adding something like the following:
119131
120-
```xml
121-
<key>NSPhotoLibraryUsageDescription</key>
122-
<string>Requires access to save downloaded media to photo library.</string>
123-
```
132+
```xml
133+
<key>NSPhotoLibraryUsageDescription</key>
134+
<string>Requires access to save downloaded media to photo library.</string>
135+
```
124136
125137
> **NOTE**: if you do use the perms plugin in a production app, make sure to read their README.md first, as using this plugin in production apps will require you to add all iOS Info.plist permission strings to avoid being rejected by automatic processing since the plugin includes code for all permission types.
126138
127139
## Acknowledgements
128140
129-
This plugin was inspired by https://github.com/tobydeh/nativescript-download-progress/.
141+
This plugin was inspired by https://github.com/tobydeh/nativescript-download-progress
130142
131143
## License
132144

packages/nativescript-filepicker/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ https://github.com/VoiceThread/nativescript-plugins/assets/20136906/ba6dcba1-bfd
2020
- [Contents](#contents)
2121
- [Installation](#installation)
2222
- [Usage](#usage)
23-
- [Android Permissions](#android-permissions)
24-
- [iOS Permissions](#ios-permissions)
23+
- [Android Permissions](#android-permissions)
24+
- [iOS Permissions](#ios-permissions)
2525
- [Supported Picker File Types](#supported-picker-file-types)
2626
- [Android](#android)
2727
- [iOS](#ios)
@@ -32,9 +32,12 @@ https://github.com/VoiceThread/nativescript-plugins/assets/20136906/ba6dcba1-bfd
3232
## Installation
3333

3434
```bash
35-
npm install @voicethread/nativescript-filepicker
35+
npm install @voicethread/nativescript-filepicker --save
36+
```
37+
OR
38+
```bash
39+
ns plugin install @voicethread/nativescript-filepicker
3640
```
37-
3841
## Usage
3942

4043
The best way to understand how to use the plugin is to look at the demo app included in this repo.

0 commit comments

Comments
 (0)