makeVoiceCall function

dynamic makeVoiceCall(
  1. Rx<ProfileDetails> profile,
  2. Rx<AvailableFeatures> availableFeatures
)

Implementation

makeVoiceCall(
    Rx<ProfileDetails> profile, Rx<AvailableFeatures> availableFeatures) async {
  if (profile.value.isAdminBlocked.checkNull()) {
    toToast(getTranslated("adminBlockedUser"));
    return;
  }
  if (profile.value.isBlocked.checkNull()) {
    showBlockStatusAlert(makeVoiceCall, profile, availableFeatures);
    return;
  }
  if (!availableFeatures.value.isOneToOneCallAvailable.checkNull()) {
    DialogUtils.showFeatureUnavailable();
    return;
  }
  if ((await Mirrorfly.isOnGoingCall()).checkNull()) {
    debugPrint("#Mirrorfly Call You are on another call");
    toToast(getTranslated("msgOngoingCallAlert"));
    return;
  }
  if (!(await AppUtils.isNetConnected())) {
    toToast(getTranslated("noInternetConnection"));
    return;
  }
  if (await AppPermission.askAudioCallPermissions()) {
    Mirrorfly.makeVoiceCall(
        toUserJid: profile.value.jid.checkNull(),
        flyCallBack: (FlyResponse response) {
          if (response.isSuccess) {
            NavUtils.toNamed(Routes.outGoingCallView, arguments: {
              "userJid": [profile.value.jid],
              "callType": CallType.audio
            });
          }
        });
  } else {
    debugPrint("permission not given");
  }
}