requestVideoCallPermissions static method

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

Implementation

static Future<bool> requestVideoCallPermissions(
    {required String content,
    required List<Permission> permissions,
    bool showFromRational = false}) async {
  var deniedPopupValue = await mirrorFlyPermissionDialog(
      icon: recordAudioVideoPermission,
      content: content,
      dialogStyle:
          AppStyleConfig.dialogStyle); //Constants.videoCallPermission);
  if (deniedPopupValue) {
    var newp = await permissions.request();
    PermissionStatus? microphone_ = newp[Permission.microphone];
    PermissionStatus? phone_ = newp[Permission.phone];
    PermissionStatus? camera_ = newp[Permission.camera];
    PermissionStatus? bluetoothConnect_ = newp[Permission.bluetoothConnect];
    PermissionStatus? notification_ = newp[Permission.notification];
    if (camera_ != null /*&& camera_.isPermanentlyDenied*/) {
      SessionManagement.setBool(Constants.cameraPermissionAsked, true);
    }
    if (microphone_ != null /*&&microphone_.isPermanentlyDenied*/) {
      SessionManagement.setBool(Constants.audioRecordPermissionAsked, true);
    }
    if (phone_ != null /*&& phone_.isPermanentlyDenied*/) {
      SessionManagement.setBool(
          Constants.readPhoneStatePermissionAsked, true);
    }
    if (bluetoothConnect_ !=
        null /*&&bluetoothConnect_.isPermanentlyDenied*/) {
      SessionManagement.setBool(Constants.bluetoothPermissionAsked, true);
    }
    if (notification_ != null /*&&notification_.isPermanentlyDenied*/) {
      SessionManagement.setBool(Constants.notificationPermissionAsked, true);
    }
    return (camera_?.isGranted ?? true) &&
        (microphone_?.isGranted ?? true) &&
        (phone_?.isGranted ?? true) &&
        (bluetoothConnect_?.isGranted ?? true) &&
        (notification_?.isGranted ?? true);
  } else {
    return false;
  }
}