makeCall method

dynamic makeCall(
  1. List<String>? userList,
  2. String callType,
  3. CallLogData item
)

Implementation

makeCall(List<String>? userList, String callType, CallLogData item) async {
  if (userList == null || userList.isEmpty) {
    return;
  }
  if ((await Mirrorfly.isOnGoingCall()).checkNull()) {
    debugPrint("#Mirrorfly Call You are on another call");
    toToast(getTranslated("msgOngoingCallAlert"));
    return;
  }
  if (!(await AppUtils.isNetConnected())) {
    toToast(getTranslated("noInternetConnection"));
    return;
  }
  if (!availableFeatures.value.isGroupCallAvailable.checkNull()) {
    DialogUtils.showFeatureUnavailable();
    return;
  }
  if (callType == CallType.video) {
    if (await AppPermission.askVideoCallPermissions()) {
      // NavUtils.back();
      Mirrorfly.makeGroupVideoCall(
          groupJid: item.groupId.checkNull(),
          toUserJidList: userList,
          flyCallBack: (FlyResponse response) {
            if (response.isSuccess) {
              NavUtils.toNamed(Routes.outGoingCallView, arguments: {
                "userJid": userList,
                "callType": CallType.video
              });
            }
          });
    }
  } else {
    if (await AppPermission.askAudioCallPermissions()) {
      // NavUtils.back();
      Mirrorfly.makeGroupVoiceCall(
          groupJid: item.groupId.checkNull(),
          toUserJidList: userList,
          flyCallBack: (FlyResponse response) {
            if (response.isSuccess) {
              NavUtils.toNamed(Routes.outGoingCallView, arguments: {
                "userJid": userList,
                "callType": CallType.audio
              });
            }
          });
    }
  }
}