Extensions on
V2TIMManager
Methods
addSignalingListener(listener:)
public func addSignalingListener(listener: V2TIMSignalingListener)
1.1 Add the signaling listener
removeSignalingListener(listener:)
public func removeSignalingListener(listener: V2TIMSignalingListener)
1.2 Remove the signaling listener
invite(invitee:data:onlineUserOnly:offlinePushInfo:timeout:succ:fail:)
public func invite(invitee: String, data: String?, onlineUserOnly: Bool, offlinePushInfo: V2TIMOfflinePushInfo?, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?
1.3 Invite someone
Parameters
Name | Type | Description |
---|---|---|
invitee | String |
Invitee's user ID |
data | String? |
Custom data |
timeout | Int |
Timeout duration, in seconds. If it is set to 0, the SDK does not perform timeout detection nor trigger the onInvitationTimeout callback. |
onlineUserOnly | Bool |
Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). The invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). |
offlinePushInfo | V2TIMOfflinePushInfo? |
Offline push information, where the desc field is required. The information specified by desc will be displayed by default during push. |
Returns
inviteID Invitation ID. If the invitation fails, null is returned.
inviteInGroup(groupID:inviteeList:data:onlineUserOnly:timeout:succ:fail:)
public func inviteInGroup(groupID: String, inviteeList: Array<String>, data: String?, onlineUserOnly: Bool, timeout: Int, succ: V2TIMSucc?, fail: V2TIMFail?) -> String?
1.4 Invite certain users in the group
Parameters
Name | Type | Description |
---|---|---|
groupID | String |
ID of the inviter's group |
inviteeList | Array<String> |
List of invitees. Invitees specified by inviteeList must be in the group specified by groupID. Otherwise, the invitation fails. |
timeout | Int |
Timeout duration, in seconds. If it is set to 0, the SDK does not perform timeout detection nor trigger the onInvitationTimeout callback. |
onlineUserOnly | Bool |
Whether the message can be received only by online users. If this field is set to true, the message can be received only by online users, and the invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). The invite operation does not produce historical messages (nor do subsequent cancel, accept, reject, and timeout operations of this invite operation). |
Returns
inviteID Invitation ID. If the invitation fails, null is returned.
cancel(inviteID:data:succ:fail:)
public func cancel(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)
1.5 The inviter canceled the invitation
Parameters
Name | Type | Description |
---|---|---|
inviteID | String |
Invitation ID |
accept(inviteID:data:succ:fail:)
public func accept(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)
1.6 The invitee accepts the invitation
reject(inviteID:data:succ:fail:)
public func reject(inviteID: String, data: String?, succ: V2TIMSucc?, fail: V2TIMFail?)
1.7 The invitee rejects the invitation
getSignallingInfo(msg:)
public func getSignallingInfo(msg: V2TIMMessage) -> V2TIMSignalingInfo?
1.8 Get the signaling information
If onlineUserOnly is set to false in the invite operation, a custom message is generated for each signaling operation (including the invite, cancel, accept, reject, and timeout operations). The message will be delivered to users via V2TIMAdvancedMsgListener -> onRecvNewMessage and can be pulled by users via historical message pulling. If you want to customize the display text based on the signaling information, call the following API to get the signaling information.
Parameters
Name | Type | Description |
---|---|---|
msg | V2TIMMessage |
Message object |
Returns
V2TIMSignalingInfo Signaling information. If the value is nil, msg is not a signaling message.
addInvitedSignaling(signalingInfo:succ:fail:)
public func addInvitedSignaling(signalingInfo: V2TIMSignalingInfo, succ: V2TIMSucc?, fail: V2TIMFail?)
1.9 Add invitation signaling (can be used for invitation signaling triggered by group offline push messages)
In offline push scenarios:
-
One-to-one invitation: if the invitee's app is killed and is started again when receiving an offline push, the user will receive the onReceiveNewInvitation callback if the invitation does not time out and receive the onInvitationTimeout callback if the invitation times out.
-
Group invitation: if the invitee's app is killed and is started again when receiving an offline push, the SDK cannot automatically sync the invitation signaling information. If you want to process the invitation in this scenario, contain the signaling information when sending the push message, parse the signaling information when receiving the push, and call addInvitedSignaling to proactively add the signaling information. TUIKit implements offline push for audio/video calls based on this API. For details of the implementation method, see Enabling Audio/Video Calls
modifyInvitation(inviteID:data:succ:fail:)
public func modifyInvitation(inviteID: String, data: String, succ: V2TIMSucc?, fail: V2TIMFail?)
1.10 Modify the invitaion (supported only in 6.7 and later versions)