Skip to content

Releases: GetStream/stream-chat-android

setUser callback, ClientState and add/remove channel members

10 Oct 21:07
e1d9b33
Compare
Choose a tag to compare
  • 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

09 Oct 16:55
aa7422e
Compare
Choose a tag to compare
  • 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 and client.setUser
  • Add reload method to ChannelListViewModel
  • Bugfix: hides attachment drawer after deny permission
  • Add support for update channel endpoint
  • Add PermissionRequestListener for Permission Request

2.2.0-alpha5

09 Oct 12:38
Compare
Choose a tag to compare
2.2.0-alpha5 Pre-release
Pre-release
bump up the version name for sample app

2.2.0-alpha4

08 Oct 23:37
Compare
Choose a tag to compare
2.2.0-alpha4 Pre-release
Pre-release
Merge branch 'bug/threadSafety'

2.2.0-alpha3: Merge pull request #113 from GetStream/fix/offline-message-send2

08 Oct 17:07
7966341
Compare
Choose a tag to compare
Fix/offline message send2

Second alpha for 2.2.0

07 Oct 22:02
Compare
Choose a tag to compare
Pre-release
2.2.0-alpha2

fix null pointer error on resume

Alpha version of 2.2.0

07 Oct 17:47
c14575d
Compare
Choose a tag to compare
Pre-release
Merge pull request #103 from GetStream/fix/switch-user-fix

make sure we progress from CONNECTING to CONNECTED when switching to …

Token Renewal Flow

30 Sep 07:17
59abfb5
Compare
Choose a tag to compare

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());
                }
            });
        }
);

2.0.1

28 Sep 15:57
2a97768
Compare
Choose a tag to compare
Update CHANGELOG.md

2.0.0

26 Sep 20:49
35b890b
Compare
Choose a tag to compare

Improve ease of use around channel initialization, better channel method naming (watch and query)