[AND-190] Add "Unblock user" as message option in the UI SDKs. #5533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Linear: https://linear.app/stream/issue/AND-190/implement-unblock-user-message-menu-option
Implements the "Unblock user" message option, which would be shown in the default message menu instead of the "Block user" option if the user is already blocked.
Additionally we expose two ways of fetching/observing the current user's blocked users:
GlobalState
(in theStatePlugin
)ClientState.user
(in case theStatePlugin
is not applied)🛠 Implementation details
Client / State
blockedUserIds
field in theUser
model. Can be read for the currently logged in user.blockedUserIds
field in theGlobalState
. Can be observed fromChatClient.globalState
from theStatePlugin
.blockedUserIds
field is delivered viaHasOwnUser
WS events.HasOwnUser
events inEventHandlerSequential
to ensure the data is up-to-date.BlockUserListener
/UnblockUserListener
/QueryBlockedUsersListener
as part of thePlugin
.BlockUserListenerState
/UnblockUserListenerState
/QueryBlockedUsersListenerState
to ensure theGlobalState.blockedUserIds
is up-to-date.ChatClient
blockUser
/unblockUser
with logic updating themutableClientState
anduserStateService
. This makes sure that theblockedUserIds
data stored in theChatClient current user
is up-to-date. (relevant for customers not using the state plugin)UI
🎨 UI Changes
block-unblock-user-demo-compose.mp4
🧪 Testing