requestAudioCallPermissions static method
Future<bool>
requestAudioCallPermissions({
- required String content,
- required List<
Permission> permissions, - bool showFromRational = false,
- required BuildContext context,
Implementation
static Future<bool> requestAudioCallPermissions(
{required String content,
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: content,
context: context,
appName: AppConstants.appName);
if (deniedPopupValue) {
var newp = await permissions.request();
PermissionStatus? microphone_ = newp[Permission.microphone];
PermissionStatus? phone_ = newp[Permission.phone];
PermissionStatus? bluetoothConnect_ = newp[Permission.bluetoothConnect];
PermissionStatus? notification_ = newp[Permission.notification];
if (microphone_ != null) {
LogMessage.d("microphone_", microphone_.isPermanentlyDenied);
SessionManagement.setBool(Constants.audioRecordPermissionAsked, true);
}
if (phone_ != null) {
LogMessage.d("phone_", phone_.isPermanentlyDenied);
SessionManagement.setBool(
Constants.readPhoneStatePermissionAsked, true);
}
if (bluetoothConnect_ != null) {
LogMessage.d(
"bluetoothConnect_", bluetoothConnect_.isPermanentlyDenied);
SessionManagement.setBool(Constants.bluetoothPermissionAsked, true);
}
if (notification_ != null) {
LogMessage.d("notification_", notification_.isPermanentlyDenied);
SessionManagement.setBool(
Constants.notificationPermissionAsked, true);
}
return (microphone_?.isGranted ?? true) &&
(phone_?.isGranted ?? true) &&
(bluetoothConnect_?.isGranted ?? true) &&
(notification_?.isGranted ?? true);
} else {
return false;
}
} else {
return false;
}
}