Releases: GetStream/stream-chat-android
Releases · GetStream/stream-chat-android
setUser callback, ClientState and add/remove channel members
- Added a callback as an optional last argument for setUser functions
- Added ClientState which stores users, current user, unreadCount and the current user's mutes
- Added notification.mutes_updated event
- Add support for add/remove channel members
setUser
Adds an optional callback argument to all setUser functions. For example:
client.setUser(user, USER_TOKEN, new ClientConnectionCallback() {
@Override
public void onSuccess(User user) {
Log.i(TAG, String.format("Connection established for user %s", user.getName()));
}
@Override
public void onError(String errMsg, int errCode) {
Log.e(TAG, String.format("Failed to establish websocket connection. Code %d message %s", errCode, errMsg));
}
});
The setUser call with a token provider also allows you to add a callback.
Related #118
ClientState
Implements client state similar to the JS client so you can work with mutes, unread count, and user presence
client.getState().getCurrentUser().getMutes()
client.getState().getUnreadChannels()
client.getState().getTotalUnreadCount()
// note that the above 2 give you the up to date unread count, it automatically updates when there are new event. it however doesn't expose a livedata object
// for live data see `StreamChat.getUnreadChannels` and `StreamChat.getTotalUnreadMessages`
StreamChat LiveData
StreamChat.getTotalUnreadMessages().observe(this, (Number count) -> {
Log.i(TAG, String.format("Total unread message count is now %d", count));
});
StreamChat.getUnreadChannels().observe(this, (Number count) -> {
Log.i(TAG, String.format("There are %d channels with unread messages", count));
});
2.2.0
- Limit message input height to 7 rows
- Fixed thread safety issues on Client.java
- Fixed serialization of custom fields for message/user/channel and attachment types
- Added support for distinct channels
- Added support to Channel hide/show
- Improved client error reporting (we now return a parsed error response when available)
- General improvements to Message Input View
- Added ReactionViewClickListener
- Added support for banning and unbanning users
- Added support for deleting a channel
- Add support for switching users via
client.disconnect
andclient.setUser
- Add
reload
method toChannelListViewModel
- Bugfix: hides attachment drawer after deny permission
- Add support for update channel endpoint
- Add PermissionRequestListener for Permission Request
2.2.0-alpha5
bump up the version name for sample app
2.2.0-alpha4
Merge branch 'bug/threadSafety'
2.2.0-alpha3: Merge pull request #113 from GetStream/fix/offline-message-send2
Pre-release
Fix/offline message send2
Second alpha for 2.2.0
2.2.0-alpha2 fix null pointer error on resume
Alpha version of 2.2.0
Merge pull request #103 from GetStream/fix/switch-user-fix make sure we progress from CONNECTING to CONNECTED when switching to …
Token Renewal Flow
Simplifies the flow of regenerating expired JWT tokens.
client.setUser(user, listener -> {
OkHttpClient httpClient = new OkHttpClient()
.newBuilder()
.build();
// request the token for this user
Request request = new Request.Builder()
.url("https://path/to/my/backend/")
.header("Authorization", "user-session-id")
.build();
httpClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
// the request to get the token failed
}
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
Log.w(TAG, "getting the token worked!");
listener.onSuccess(response.body.string());
}
});
}
);