Skip to content

Commit 987206e

Browse files
authored
Merge pull request #30 from se-schwarz/hotifx-android-include-data-is-null
Make the local data boolean a instance variable
2 parents 08807cc + c7598c5 commit 987206e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/android/Chooser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
public class Chooser extends CordovaPlugin {
2525
private static final String ACTION_OPEN = "getFile";
26-
private static final String INCLUDE_DATA = "com.cyph.cordova.INCLUDE_DATA";
2726
private static final int PICK_FILE_REQUEST = 1;
2827
private static final String TAG = "Chooser";
2928

@@ -59,6 +58,7 @@ public static String getDisplayName (ContentResolver contentResolver, Uri uri) {
5958

6059

6160
private CallbackContext callback;
61+
private Boolean includeData;
6262

6363
public void chooseFile (CallbackContext callbackContext, String accept, Boolean includeData) {
6464
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
@@ -69,7 +69,7 @@ public void chooseFile (CallbackContext callbackContext, String accept, Boolean
6969
intent.addCategory(Intent.CATEGORY_OPENABLE);
7070
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
7171
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
72-
intent.putExtra(Chooser.INCLUDE_DATA, includeData);
72+
this.includeData = includeData;
7373

7474
Intent chooser = Intent.createChooser(intent, "Select File");
7575
cordova.startActivityForResult(this, chooser, Chooser.PICK_FILE_REQUEST);
@@ -120,7 +120,7 @@ public void onActivityResult (int requestCode, int resultCode, Intent data) {
120120

121121
String base64 = "";
122122

123-
if (data.getBooleanExtra(Chooser.INCLUDE_DATA, false)) {
123+
if (this.includeData) {
124124
byte[] bytes = Chooser.getBytesFromInputStream(
125125
contentResolver.openInputStream(uri)
126126
);

0 commit comments

Comments
 (0)