requestAudioCallPermissions static method

Future<bool> requestAudioCallPermissions({
  1. required String content,
  2. required List<Permission> permissions,
  3. bool showFromRational = false,
})

Implementation

static Future<bool> requestAudioCallPermissions(
    {required String content,
    required List<Permission> permissions,
    bool showFromRational = false}) async {
  var deniedPopupValue = await mirrorFlyPermissionDialog(
      icon: audioPermission,
      content: content,
      dialogStyle:
          AppStyleConfig.dialogStyle); //Constants.audioCallPermission);
  if (deniedPopupValue) {
    LogMessage.d("deniedPopupValue", 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;
  }
}