makeVoiceCall method

void makeVoiceCall()

Implementation

void makeVoiceCall() async {
  debugPrint("#FLY CALL VOICE CALL CALLING");
  closeKeyBoard();
  if (await AppUtils.isNetConnected()) {
    if(context.mounted) {
      if (await AppPermission.askAudioCallPermissions(context)) {
        Mirrorfly.makeVoiceCall(profile.jid.checkNull()).then((value) {
          if (value) {
            debugPrint("#Mirrorfly Call userjid ${profile.jid}");
            setOnGoingUserGone();
            // Navigator.push(
            //   context,
            //   MaterialPageRoute(
            //     builder: (context) => OutGoingCallView(userJid: profile.jid!)
            //   ),
            // ).then((value) => setOnGoingUserAvail());

            MirrorflyUikit.instance.navigationManager.navigateTo(context: context,
                pageToNavigate: OutGoingCallView(userJid: profile.jid!), routeName: 'outgoing_call_view',
                onNavigateComplete: (){
                  setOnGoingUserAvail();
                });

           /* try{
            MirrorflyUikit.instance.navigatorKey.currentState?.push(MaterialPageRoute(
              builder: (context) => OutGoingCallView(userJid: profile.jid!),
            )).then((value) => setOnGoingUserAvail());
          } catch (e) {
          print("Navigation error: $e");
          }*/


          }
        }).catchError((e) {
          debugPrint("#Mirrorfly Call $e");
        });
      } else {
        debugPrint("permission not given");
      }
    }else{
      debugPrint("context is not mount");
    }
  } else {
    toToast(Constants.noInternetConnection);
  }
}