requestAudioCallPermissions static method
Future<bool>
requestAudioCallPermissions({
- required List<
Permission> permissions, - bool showFromRational = false,
- required BuildContext context,
Implementation
static Future<bool> requestAudioCallPermissions({required List<Permission> permissions,bool showFromRational = false, required BuildContext context}) async {
var info = await PackageInfo.fromPlatform();
if(context.mounted) {
var deniedPopupValue = await mirrorFlyPermissionDialog(
icon: audioPermission,
content: Constants.audioCallPermission,
context: context,
appName: info.appName);
if (deniedPopupValue) {
var newp = await permissions.request();
PermissionStatus? microphone_ = newp[Permission.microphone];
PermissionStatus? phone_ = newp[Permission.phone];
PermissionStatus? bluetoothConnect_ = newp[Permission.bluetoothConnect];
if (microphone_ != null && microphone_.isPermanentlyDenied) {
LogMessage.d("microphone_", microphone_.isPermanentlyDenied);
SessionManagement.setBool(Constants.audioRecordPermissionAsked, true);
}
if (phone_ != null && phone_.isPermanentlyDenied) {
LogMessage.d("phone_", phone_.isPermanentlyDenied);
SessionManagement.setBool(
Constants.readPhoneStatePermissionAsked, true);
}
if (bluetoothConnect_ != null &&
bluetoothConnect_.isPermanentlyDenied) {
LogMessage.d(
"bluetoothConnect_", bluetoothConnect_.isPermanentlyDenied);
SessionManagement.setBool(Constants.bluetoothPermissionAsked, true);
}
return (microphone_?.isGranted ?? true) &&
(phone_?.isGranted ?? true) &&
(bluetoothConnect_?.isGranted ?? true);
} else {
return false;
}
}else{
LogMessage.d("requestAudioCallPermissions", "Context is Not Mounted");
return false;
}
}