Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
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 @@ -419,7 +419,11 @@ private void handleCaptureImageResult(int resultCode) {
new OnPathReadyListener() {
@Override
public void onPathReady(String path) {
handleImageResult(path);
String ansPath = handleImageResult(path);
if (!path.equals(ansPath)) {
File oldFile = new File(path);
oldFile.delete();
}
}
});
return;
Expand All @@ -446,13 +450,14 @@ public void onPathReady(String path) {
finishWithSuccess(null);
}

private void handleImageResult(String path) {
private String handleImageResult(String path) {
if (pendingResult != null) {
Double maxWidth = methodCall.argument("maxWidth");
Double maxHeight = methodCall.argument("maxHeight");

String finalImagePath = imageResizer.resizeImageIfNeeded(path, maxWidth, maxHeight);
finishWithSuccess(finalImagePath);
return finalImagePath;
} else {
throw new IllegalStateException("Received image from picker that was not requested");
}
Expand Down