Users.LaunchBlockFlow(UInt64 userID)
UInt64 userID
: The ID of the user that the viewer is going to launch the block flow request.GetLaunchBlockFlowResult()
to get the results of the viewer’s actions from the modal. See Example Code 1 below for how to handle Block callback messages.LaunchBlockFlowResult.GetDidBlock
checks if the viewer selected Block from the modal.LaunchBlockFlowResult.GetDidCancel
checks if the viewer canceled or selected Back from the modal.Situation | Description | Result Feedback (LaunchBlockFlowResult) |
---|---|---|
Successful block | The user will view a dialog allowing them to Block or Cancel. The user selects Block and the block is executed successfully. | GetDidBlock : true, GetDidCancel : false |
User cancel | The user will view a dialog allowing them to Block or Cancel. The user selects Cancel and returns the viewer to the app. | GetDidBlock : false, GetDidCancel : true |
Viewer tries to block someone they blocked previously | The viewer receives a message informing them of the situation and asking whether they would like to unblock the target user. Selecting Back returns the viewer to their app. | GetDidBlock : false, GetDidCancel : true |
Viewer Tries to block themselves | The viewer receives a message indicating that this is not supported. Selecting Back returns the viewer to their app. | GetDidBlock : false, GetDidCancel : true |
The block cannot be sent for some other reason. | The user receives the message “Unable to block. Please check your connection and try again.” Selecting Back returns the viewer to the app. | GetDidBlock : false, GetDidCancel : true |
Users.LaunchUnblockFlow(UInt64 userID)
UInt64 userID
: The ID of the user that the viewer is going to launch the unblock flow request.GetLaunchUnblockFlowResult()
to get the results of the viewer’s actions from the modal. See Example Code 1 below for how to handle Block/Unblock callback messages.LaunchUnblockFlowResult.GetDidBlock
checks if the viewer selected Unblock from the modal.LaunchUnblockFlowResult.GetDidCancel
checks if the viewer canceled or selected Back from the modal.using Oculus.Platform;
Users.LaunchBlockFlow(UInt64 userID).OnComplete(OnBlockUser);
...
void OnBlockUser(Message<Models.LaunchBlockFlowResult> message) {
if (message.IsError) {
Debug.Log("Error when trying to block the user");
Debug.LogError(message.Data);
} else {
Debug.Log("Got result: DidBlock = " + message.Data.DidBlock + " DidCancel = " + message.Data.DidCancel);
}
}
...
Users.LaunchUnblockFlow(UInt64 userID).OnComplete(OnUnblockUser);
...
void OnUnblockUser(Message<Models.LaunchUnblockFlowResult> message) {
if (message.IsError) {
Debug.Log("Error when trying to unblock the user");
Debug.LogError(message.Data);
} else {
Debug.Log("Got result: DidBlock = " + message.Data.DidUnblock + " DidCancel = " + message.Data.DidCancel);
}
}
Users.GetBlockedUsers()
. This method retrieves an array of the current user’s blocked user IDs who are also entitled to your app. See Example Code 2 below on how to log the blocked user data.Users.GetNextBlockedUserArrayPage()
and paginate the data.using Oculus.Platform;
void GetBlockedUsers()
{
Users.GetBlockedUsers().OnComplete(OnGetBlockedUsers);
}
void OnGetBlockedUsers(Message<Models.BlockedUserList> message)
{
Debug.Log("EXTRACTING BLOCKED USER DATA");
if (message.IsError)
{
Debug.Log("Could not get the list of users blocked!");
Debug.LogError(message.Data);
}
else
{
foreach (Models.BlockedUser user in message.GetBlockedUserList())
{
Debug.Log("Blocked User: " + user.Id);
}
}
}