Revert "Add video/audio authorization check for Android" (#516)
This commit is contained in:
parent
877ce2e6b2
commit
76963a0a5e
|
@ -609,34 +609,6 @@ public class RCTCameraModule extends ReactContextBaseJavaModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
|
||||||
public void checkDeviceAuthorizationStatus(final Promise promise) {
|
|
||||||
if (!checkForPermission(Manifest.permission.CAMERA)) {
|
|
||||||
promise.resolve(false);
|
|
||||||
} else {
|
|
||||||
promise.resolve(checkForPermission(Manifest.permission.RECORD_AUDIO));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ReactMethod
|
|
||||||
public void checkVideoAuthorizationStatus(final Promise promise) {
|
|
||||||
promise.resolve(checkForPermission(Manifest.permission.CAMERA));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ReactMethod
|
|
||||||
public void checkAudioAuthorizationStatus(final Promise promise) {
|
|
||||||
promise.resolve(checkForPermission(Manifest.permission.RECORD_AUDIO));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkForPermission(String permission) {
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int p = ContextCompat.checkSelfPermission(getReactApplicationContext(), permission);
|
|
||||||
return p == PackageManager.PERMISSION_GRANTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void capture(final ReadableMap options, final Promise promise) {
|
public void capture(final ReadableMap options, final Promise promise) {
|
||||||
int orientation = options.hasKey("orientation") ? options.getInt("orientation") : RCTCamera.getInstance().getOrientation();
|
int orientation = options.hasKey("orientation") ? options.getInt("orientation") : RCTCamera.getInstance().getOrientation();
|
||||||
|
|
Loading…
Reference in New Issue