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

bugfix(camera): use a distinguishable permission denied string for camera and photos #379

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public class CameraPlugin extends Plugin {

// Message constants
private static final String INVALID_RESULT_TYPE_ERROR = "Invalid resultType option";
private static final String PERMISSION_DENIED_ERROR = "Unable to access camera, user denied permission request";
private static final String PERMISSION_DENIED_ERROR_CAMERA = "Unable to access camera, user denied permission request";
private static final String PERMISSION_DENIED_ERROR_PHOTOS = "Unable to access photos, user denied permission request";
private static final String NO_CAMERA_ERROR = "Device doesn't have a camera available";
private static final String NO_CAMERA_ACTIVITY_ERROR = "Unable to resolve camera activity";
private static final String IMAGE_FILE_SAVE_ERROR = "Unable to create photo on disk";
Expand Down Expand Up @@ -177,11 +178,11 @@ private boolean checkPhotosPermissions(PluginCall call) {
private void cameraPermissionsCallback(PluginCall call) {
if (settings.getSource() == CameraSource.CAMERA && getPermissionState(CAMERA) != PermissionState.GRANTED) {
Logger.debug(getLogTag(), "User denied camera permission: " + getPermissionState(CAMERA).toString());
call.reject(PERMISSION_DENIED_ERROR);
call.reject(PERMISSION_DENIED_ERROR_CAMERA);
return;
} else if (settings.getSource() == CameraSource.PHOTOS && getPermissionState(PHOTOS) != PermissionState.GRANTED) {
Logger.debug(getLogTag(), "User denied photos permission: " + getPermissionState(PHOTOS).toString());
call.reject(PERMISSION_DENIED_ERROR);
call.reject(PERMISSION_DENIED_ERROR_PHOTOS);
return;
}

Expand Down