Skip to content

feat(android): add option for showing internal/external storage #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Imagepicker plugin supporting both single and multiple selection.
- [Request permissions, show the images list and process the selection](#request-permissions-show-the-images-list-and-process-the-selection)
- [API](#api)
- [Methods](#methods)
- [Properties](#properties)
- [Image properties](#image-properties)
- [Contribute](#contribute)
- [Get Help](#get-help)

Expand Down Expand Up @@ -134,6 +132,7 @@ context
| numberOfColumnsInPortrait | iOS | 4 | Set the number of columns in Portrait orientation. |
| numberOfColumnsInLandscape | iOS | 7 | Set the number of columns in Landscape orientation. |
| mediaType | both | Any | Choose whether to pick Image/Video/Any type of assets. |
| showAdvanced | Android | false | Show internal and removable storage options on Android (**WARNING**: [not supported officially](https://issuetracker.google.com/issues/72053350)). |

The **hostView** parameter can be set to the view that hosts the image picker. Applicable in iOS only, intended to be used when open picker from a modal page.

Expand Down
4 changes: 4 additions & 0 deletions src/imagepicker.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ export class ImagePicker {
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
}

if (this._options.showAdvanced) {
intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
}

intent.putExtra(android.content.Intent.EXTRA_LOCAL_ONLY, true);
intent.setAction("android.intent.action.OPEN_DOCUMENT");
let chooser = Intent.createChooser(intent, "Select Picture");
Expand Down
6 changes: 6 additions & 0 deletions src/imagepicker.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export interface Options {
*/
mediaType?: ImagePickerMediaType;

/**
* Show internal and removable storage options on Android.
* Not supported officially, see https://issuetracker.google.com/issues/72053350 |
*/
showAdvanced?: boolean;

android?: {
/**
* Provide a reason for permission request to access external storage on api levels above 23.
Expand Down
7 changes: 7 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,19 @@ interface Options {
*/
mediaType?: ImagePickerMediaType;

/**
* Show internal and removable storage options on Android.
* Not supported officially, see https://issuetracker.google.com/issues/72053350 |
*/
showAdvanced?: boolean;

android?: {
/**
* Provide a reason for permission request to access external storage on api levels above 23.
*/
read_external_storage?: string;
};

}

/**
Expand Down