fix: Always return authorized
for requestPermission on SDK 22 and below (#344)
This commit is contained in:
parent
d64f372aa3
commit
494925c96e
@ -287,6 +287,11 @@ class CameraViewModule(reactContext: ReactApplicationContext) : ReactContextBase
|
|||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
fun requestCameraPermission(promise: Promise) {
|
fun requestCameraPermission(promise: Promise) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
|
// API 21 and below always grants permission on app install
|
||||||
|
return promise.resolve("authorized")
|
||||||
|
}
|
||||||
|
|
||||||
val activity = reactApplicationContext.currentActivity
|
val activity = reactApplicationContext.currentActivity
|
||||||
if (activity is PermissionAwareActivity) {
|
if (activity is PermissionAwareActivity) {
|
||||||
val currentRequestCode = RequestCode++
|
val currentRequestCode = RequestCode++
|
||||||
@ -306,6 +311,11 @@ class CameraViewModule(reactContext: ReactApplicationContext) : ReactContextBase
|
|||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
fun requestMicrophonePermission(promise: Promise) {
|
fun requestMicrophonePermission(promise: Promise) {
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
|
// API 21 and below always grants permission on app install
|
||||||
|
return promise.resolve("authorized")
|
||||||
|
}
|
||||||
|
|
||||||
val activity = reactApplicationContext.currentActivity
|
val activity = reactApplicationContext.currentActivity
|
||||||
if (activity is PermissionAwareActivity) {
|
if (activity is PermissionAwareActivity) {
|
||||||
val currentRequestCode = RequestCode++
|
val currentRequestCode = RequestCode++
|
||||||
|
Loading…
Reference in New Issue
Block a user