connected method
Implementation
Future<void> connected(String callMode, String userJid, String callType,
String callStatus) async {
// this.callStatus(callStatus);
// getNames();
// startTimer();
/*Future.delayed(const Duration(milliseconds: 500), () {
Get.offNamed(Routes.onGoingCallView, arguments: {"userJid": userJid});
});*/
this.callMode(callMode);
this.callType(callType);
// this.callStatus(callStatus);
// startTimer();
if (MirrorflyUikit.instance.navigationManager.getCurrentRoute() ==
Constants.onGoingCallView &&
MirrorflyUikit.instance.navigationManager.getCurrentRoute() ==
Constants.participantView) {
Future.delayed(const Duration(milliseconds: 500), () {
// Get.offNamed(Routes.onGoingCallView, arguments: {"userJid": [userJid], "cameraSwitch": cameraSwitch.value});
MirrorflyUikit.instance.navigationManager.navigatePushReplacement(
context: context,
pageToNavigate: OnGoingCallView(userJid: [userJid]),
routeName: Constants.onGoingCallView);
});
} else if (MirrorflyUikit.instance.navigationManager.getCurrentRoute() ==
Constants.participantView) {
//commenting this for when user reconnected then toast is displayed so no need to display
// var data = await getProfileDetails(userJid);
// toToast("${data.getName()} joined the Call");
} else {
var isAudioMuted =
(await Mirrorfly.isUserAudioMuted(userJid: userJid)).checkNull();
var isVideoMuted =
(await Mirrorfly.isUserVideoMuted(userJid: userJid)).checkNull();
var indexValid =
callList.indexWhere((element) => element.userJid?.value == userJid);
debugPrint("#MirrorflyCall user jid $userJid");
CallUserList callUserList = CallUserList(
userJid: userJid.obs,
callStatus: RxString(callStatus),
isAudioMuted: isAudioMuted,
isVideoMuted: isVideoMuted,
);
if (indexValid.isNegative) {
callList.insert(callList.length - 1, callUserList);
// callList.add(callUserList);
debugPrint("#MirrorflyCall List value updated ${callList.length}");
} else {
debugPrint(
"#MirrorflyCall List value not updated due to jid $userJid is already in list ${callList.length}");
}
}
}