makeVoiceCall method

void makeVoiceCall()

Implementation

void makeVoiceCall() async {
  debugPrint("#FLY CALL VOICE CALL CALLING");
  closeKeyBoard();
  AppUtils.isNetConnected().then((value) {
    if (value) {
      AppPermission.askAudioCallPermissions(context).then((permission) {
        if (permission) {
          if (profile.isGroupProfile.checkNull()) {
            MirrorflyUikit.instance.navigationManager.navigateTo(
              context: context,
              pageToNavigate: GroupParticipantsView(
                groupId: profile.jid!,
                callType: CallType.audio,
              ),
              routeName: Constants.groupParticipantView,
            );
          } else {
            Mirrorfly.makeVoiceCall(
                toUserJid: profile.jid.checkNull(),
                flyCallBack: (FlyResponse response) {
                  if (response.isSuccess) {
                    debugPrint("#Mirrorfly Call userjid ${profile.jid}");
                    setOnGoingUserGone();
                    MirrorflyUikit.instance.navigationManager.navigateTo(
                        context: context,
                        pageToNavigate: OutGoingCallView(
                            userJid: [profile.jid.checkNull()]),
                        routeName: Constants.outGoingCallView,
                        onNavigateComplete: () {
                          setOnGoingUserAvail();
                        });
                  }
                });
          }
        } else {
          debugPrint("permission not given");
        }
      });
    } else {
      toToast(Constants.noInternetConnection);
    }
  });
}