videoCallConversionRequest method
void
videoCallConversionRequest(
- String userJid
)
Implementation
void videoCallConversionRequest(String userJid) async {
inComingRequest = true;
if (showingVideoSwitchPopup) {
closeDialog();
}
//if both users are made switch request then accept the request without confirmation popup
LogMessage.d("Both Call Switch Request",
"inComingRequest : $inComingRequest outGoingRequest : $outGoingRequest");
if (inComingRequest && outGoingRequest) {
inComingRequest = false;
outGoingRequest = false;
Mirrorfly.acceptVideoCallSwitchRequest().then((value) {
videoMuted(false);
callType(CallType.video);
});
return;
}
var profile = await getProfileDetails(userJid);
isVideoCallRequested = true;
if (!context.mounted) return;
Helper.showAlert(
message:
"${profile.getName()} ${Constants.videoSwitchRequestedMessage}",
actions: [
TextButton(
onPressed: () {
isVideoCallRequested = false;
inComingRequest = false;
closeDialog();
Mirrorfly.declineVideoCallSwitchRequest();
},
child: const Text("DECLINE",
style: TextStyle(color: buttonBgColor))),
TextButton(
onPressed: () async {
closeDialog();
if (await AppPermission.askVideoCallPermissions(context)) {
isVideoCallRequested = false;
inComingRequest = false;
Mirrorfly.acceptVideoCallSwitchRequest().then((value) {
videoMuted(false);
callType(CallType.video);
});
} else {
Future.delayed(const Duration(milliseconds: 500), () {
toToast("Camera Permission Needed to switch the call");
});
Mirrorfly.declineVideoCallSwitchRequest();
}
},
child:
const Text("ACCEPT", style: TextStyle(color: buttonBgColor)))
],
barrierDismissible: false,
context: context);
}