makeVoiceCall method

void makeVoiceCall()

Implementation

void makeVoiceCall() async {
  debugPrint("#FLY CALL VOICE CALL CALLING");
  closeKeyBoard();
  if (await AppUtils.isNetConnected()) {
    if (await AppPermission.askAudioCallPermissions()) {
      if (profile.isGroupProfile.checkNull()) {
        if (isMemberOfGroup) {
          NavUtils.toNamed(Routes.groupParticipants, arguments: {
            "groupId": profile.jid,
            "callType": CallType.audio
          });
        }
      } else {
        Mirrorfly.makeVoiceCall(
            toUserJid: profile.jid.checkNull(),
            flyCallBack: (FlyResponse response) {
              if (response.isSuccess) {
                debugPrint("#Mirrorfly Call userjid ${profile.jid}");
                setOnGoingUserGone();
                NavUtils.toNamed(Routes.outGoingCallView, arguments: {
                  "userJid": [profile.jid],
                  "callType": CallType.audio
                })?.then((value) => setOnGoingUserAvail());
              } else {
                DialogUtils.showAlert(
                    dialogStyle: AppStyleConfig.dialogStyle,
                    message: getErrorDetails(response),
                    actions: [
                      TextButton(
                          onPressed: () => NavUtils.back(),
                          child: Text(getTranslated("ok").toUpperCase()))
                    ]);
              }
            });
      }
    } else {
      debugPrint("permission not given");
    }
  } else {
    toToast(getTranslated("noInternetConnection"));
  }
}