// Hides the channel until a new message is added there channelClient.hide().enqueue { result -> if (result is Result.Success) { // Channel is hidden } else { // Handle Result.Failure } } // Shows a previously hidden channel channelClient.show().enqueue { result -> if (result is Result.Success) { // Channel is shown } else { // Handle Result.Failure } } // Hide the channel and clear the message history channelClient.hide(clearHistory = true).enqueue { result -> if (result is Result.Success) { // Channel is hidden } else { // Handle Result.Failure } }Hiding Channels
Hiding a channel removes it from query channel requests for that user until a new message is added. Only channel members can hide a channel.
Hidden channels may still have unread messages. Consider marking the channel as read before hiding it.
You can optionally clear the message history for that user when hiding. When a new message is received, it will be the only message visible to that user.
Hide a Channel
// hides the channel until a new message is added there await channel.hide(); // hides the channel until a new message is added there. This also clears the history for the user await channel.hide(null, true); // shows a previously hidden channel await channel.show();// hides the channel until a new message is added there $channel->hide("john"); // shows a previously hidden channel $channel->show("john");// hides the channel until a new message is added there await channel.hide(); // shows a previously hidden channel await channel.show(); // hide the channel and clear the message history await channel.hide(clearHistory: true);import Stream Chat let controller = chatClient.channelController(for: .init(type: .messaging, id: "general")) // hide channel controller.hideChannel { error in if let error = error { // handle error print(error) } } // show channel controller.showChannel { error in if let error = error { // handle error print(error) } } // hide channel and clear message history controller.hideChannel(clearHistory: true) { error in if let error = error { // handle error print(error) } }// hides the channel until a new message is added there Channel->Hide(); // shows a previously hidden channel Channel->Show(); // hide the channel and clear the message history Channel->Hide(true);# Hide the channel until a new message is added channel.hide("john") # Show a previously hidden channel channel.show("john")# Hide the channel until a new message is added channel.hide("john") # Show a previously hidden channel channel.show("john")// hides the channel until a new message is added there await channelClient.HideAsync("<channel-type>", "<channel-id>", "john"); // shows a previously hidden channel await channelClient.ShowAsync("<channel-type>", "<channel-id>", "john");// hides the channel until a new message is added there channel.hide(ctx, "john"); // shows a previously hidden channel channel.show(ctx, "john");// Hides the channel until a new message is added there channelClient.hide(false).enqueue(result -> { if (result.isSuccess()) { // Channel is hidden } else { // Handle result.error() } }); // Shows a previously hidden channel channelClient.show().enqueue(result -> { if (result.isSuccess()) { // Channel is shown } else { // Handle result.error() } }); // Hide the channel and clear the message history channelClient.hide(true).enqueue(result -> { if (result.isSuccess()) { // Channel is hidden } else { // Handle result.error() } });// Hide a channel await channel.HideAsync(); // Show previously hidden channel await channel.ShowAsync();You can still retrieve the list of hidden channels using the { "hidden" : true } query parameter.