inviteInGroup static method

Future<V2TimValueCallback<String>> inviteInGroup({
  1. required String groupID,
  2. required List<String> inviteeList,
  3. required String data,
  4. int timeout = 30,
  5. bool onlineUserOnly = false,
})

Implementation

static Future<V2TimValueCallback<String>> inviteInGroup({
  required String groupID,
  required List<String> inviteeList,
  required String data,
  int timeout = 30,
  bool onlineUserOnly = false,
}) async {
  // send custom message and handle timeout.
  String inviteID = Tools.generateUserData();
  V2TimValueCallback<String> user = await getLoginUser();
  String customData = _buildSignalData(
    type: V2SignalingActionType.SIGNALING_ACTION_TYPE_INVITE,
    customData: data,
    inviteID: inviteID,
    timeout: timeout,
    groupID: groupID,
    inviteeList: inviteeList,
    inviter: user.data ?? "",
    onlineUserOnly: onlineUserOnly,
  );
  int code = await _sendCustomData(
    data: customData,
    groupID: groupID,
    onlineUserOnly: onlineUserOnly,
  );
  if (code == 0) {
    currentInvite = json.decode(customData);
    _timeout(timeout, inviteID);
  }
  return V2TimValueCallback(
    code: code,
    data: inviteID,
    desc: code == 0 ? "success" : "error",
  );
}