Skip to content

Commit

Permalink
refactor(android)!: Unify gallery cancel message (#1967)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Dec 18, 2023
1 parent 30b23b6 commit fb12c04
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -104,6 +103,7 @@ public class CameraPlugin extends Plugin {
private static final String UNABLE_TO_PROCESS_IMAGE = "Unable to process image";
private static final String IMAGE_EDIT_ERROR = "Unable to edit image";
private static final String IMAGE_GALLERY_SAVE_ERROR = "Unable to save the image in the gallery";
private static final String USER_CANCELLED = "User cancelled photos app";

private String imageFileSavePath;
private String imageEditedFileSavePath;
Expand Down Expand Up @@ -180,7 +180,7 @@ private void showPrompt(final PluginCall call) {
openCamera(call);
}
},
() -> call.reject("User cancelled photos app")
() -> call.reject(USER_CANCELLED)
);
fragment.show(getActivity().getSupportFragmentManager(), "capacitorModalsActionSheet");
}
Expand Down Expand Up @@ -376,7 +376,7 @@ private void openPhotos(final PluginCall call, boolean multiple) {
}
);
} else {
call.reject("No images picked");
call.reject(USER_CANCELLED);
}
pickMultipleMedia.unregister();
}
Expand All @@ -393,7 +393,7 @@ private void openPhotos(final PluginCall call, boolean multiple) {
imagePickedContentUri = uri;
processPickedImage(uri, call);
} else {
call.reject("No image picked");
call.reject(USER_CANCELLED);
}
pickMedia.unregister();
}
Expand Down Expand Up @@ -421,7 +421,7 @@ public void processCameraImage(PluginCall call, ActivityResult result) {
Bitmap bitmap = BitmapFactory.decodeFile(imageFileSavePath, bmOptions);

if (bitmap == null) {
call.reject("User cancelled photos app");
call.reject(USER_CANCELLED);
return;
}

Expand All @@ -432,7 +432,7 @@ public void processPickedImage(PluginCall call, ActivityResult result) {
settings = getSettings(call);
Intent data = result.getData();
if (data == null) {
call.reject("No image picked");
call.reject(USER_CANCELLED);
return;
}

Expand Down

0 comments on commit fb12c04

Please sign in to comment.