makeVoiceCall method

void makeVoiceCall(
  1. String? toUser
)

Implementation

void makeVoiceCall(String? toUser) async {
  debugPrint("#FLY CALL VOICE CALL CALLING");
  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: toUser.checkNull(),
        flyCallBack: (FlyResponse response) {
          if (response.isSuccess) {
            debugPrint("#Mirrorfly Call userjid $toUser");
            //  setOnGoingUserGone();
            NavUtils.toNamed(Routes.outGoingCallView, arguments: {
              "userJid": [toUser],
              "callType": CallType.audio
            })?.then((value) => setOnGoingUserAvail());
          }
        });
  } else {
    debugPrint("permission not given");
  }
}