iOS: requestCameraPermission resolved too early
See original GitHub issueIn our code, when the user uses the barcodescanner for the first time, we call the methode requestCameraPermission
. Based on what the user choses, we either go to scan the code or show an alert that the permission was not granted for the functionality. The code looks like this:
this.barcodeScanner.requestCameraPermission()`
.then(() => this._barcodeScanner.hasCameraPermission()) //workaround for Android
.then((hasPermission: boolean) => {
if (hasPermission) {
this.scanQRCode();
} else {
this.showPermissionAlert();
}
})
.catch(() => {
this.showPermissionAlert();
});
On iOS, it seems that the first time the user does get the alert with the question if he/she will grant camera acces, but in the code we saw with logging that the promise of the requestCameraPermission
was already resolved and it is waiting in the showPermissionAlert
function waiting till the alert is closed. So even when the user grants permission, he/she still will get the permission alert right after.
Shouldn’t it be that the requestCameraPermission
promise would only be resolved after the user grants or denies camera acces?
Android works correctly as expected, this is only problem on iOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Yep, I linked to that bit 😃- cheers mate!
Here is it :