hide method

Future<void> hide(
  1. {bool hidePreviousMessage = false,
  2. bool allowAutoUnhide = true}
)

Hides this channel from the current User's GroupChannel` list. When a new message is received from the channel, it appears again.

If hidePreviousMessage is set true, the messages created before the hide will not be loaded anymore when the channel reappears. If allowAutoUnhide is set true, when a new message is received from the channel, it appears again.

Implementation

Future<void> hide({
  bool hidePreviousMessage = false,
  bool allowAutoUnhide = true,
}) async {
  sbLog.i(StackTrace.current,
      'hidePreviousMessage: $hidePreviousMessage, allowAutoUnhide: $allowAutoUnhide');

  final res = await chat.apiClient.send(GroupChannelHideRequest(
    chat,
    channelUrl,
    hidePreviousMessages: hidePreviousMessage,
    allowAutoUnhide: allowAutoUnhide,
  ));

  messageOffsetTimestamp = res?['ts_message_offset'] as int?;
  if (hidePreviousMessage) clearUnreadCount();

  isHidden = true;
  hiddenState = allowAutoUnhide
      ? GroupChannelHiddenState.allowAutoUnhide
      : GroupChannelHiddenState.preventAutoUnhide;
}