Skip to content

Commit

Permalink
fix(camera): return single picture on pickImages (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jan 26, 2022
1 parent 897dcaf commit 9d65db1
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,26 @@ public void processPickedImage(PluginCall call, ActivityResult result) {
@ActivityCallback
public void processPickedImages(PluginCall call, ActivityResult result) {
Intent data = result.getData();
if (data != null && data.getClipData() != null) {
if (data != null) {
Executor executor = Executors.newSingleThreadExecutor();
executor.execute(
() -> {
JSObject ret = new JSObject();
JSArray photos = new JSArray();
int count = data.getClipData().getItemCount();
for (int i = 0; i < count; i++) {
Uri imageUri = data.getClipData().getItemAt(i).getUri();
if (data.getClipData() != null) {
int count = data.getClipData().getItemCount();
for (int i = 0; i < count; i++) {
Uri imageUri = data.getClipData().getItemAt(i).getUri();
JSObject processResult = processPickedImages(imageUri);
if (processResult.getString("error") != null && !processResult.getString("error").isEmpty()) {
call.reject(processResult.getString("error"));
return;
} else {
photos.put(processResult);
}
}
} else if (data.getData() != null) {
Uri imageUri = data.getData();
JSObject processResult = processPickedImages(imageUri);
if (processResult.getString("error") != null && !processResult.getString("error").isEmpty()) {
call.reject(processResult.getString("error"));
Expand Down

0 comments on commit 9d65db1

Please sign in to comment.