Skip to content
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

refactor(android)!: Unify gallery cancel message #1967

Merged
merged 1 commit into from
Dec 18, 2023
Merged
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
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
Loading