accept static method

Future<V2TimCallback> accept({
  1. required String inviteID,
  2. String? data,
})

Implementation

static Future<V2TimCallback> accept({
  required String inviteID,
  String? data,
}) async {
  if (currentInvite["inviteID"] != null) {
    V2TimValueCallback<String> user = await getLoginUser();
    String customData = _buildSignalData(
      type: V2SignalingActionType.SIGNALING_ACTION_TYPE_ACCEPT_INVITE,
      customData: data ?? "",
      inviteID: inviteID,
      timeout: currentInvite["timeout"],
      groupID: currentInvite["groupID"],
      inviteeList: [user.data ?? ""],
      inviter: currentInvite["inviter"],
    );
    int code = await _sendCustomData(
      data: customData,
      groupID: currentInvite["groupID"] ?? "",
      toUserId: _isGroupCall(currentInvite) ? "" : currentInvite["inviter"],
    );
    rmUserFormInviteeList(user.data ?? "", inviteID);

    if (timeoutTimer[inviteID] != null) {
      timeoutTimer[inviteID]!.cancel();
      timeoutTimer[inviteID] = null;
    }
    signalingListenerList.forEach((key, value) {
      value.onInviteeAccepted(inviteID, user.data ?? "", data ?? "");
    });
    return V2TimCallback(code: code, desc: code == 0 ? "success" : "error");
  }
  return V2TimCallback(code: 8010, desc: "inviteID is invalid or invitation has been processed");
}