twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
62 stars 51 forks source link

User unsubscribe() method not working as expected #106

Closed fede87 closed 5 years ago

fede87 commented 5 years ago

Description

Calling unsubscribe method on a subscribed user prevents that the same user can be subscribed again. The next time the member.getAndSubscribeUser(callback) method is called the CallbackListener callback is never going to be triggered neither with the onError(erroInfo). The same flow was working instead on v3.1.1 version. The same issue is present also on iOS Chat SDK.

Steps to Reproduce

  1. call member.getAndSubscribeUser(callback) or client.users.getAndSubscribeUser(identity, callback) and wait for the onSuccess(user) callback has been called.
  2. call user.unsubscribe() when the user's updates are no longer needed.
  3. go thru step 1 again but callback will no longer be triggered

Code

This use case has been tested on the demo app and can be easily reproduced adding the following code to MessageActivity.kt:

    override fun onDestroy() {
        channel?.removeListener(this@MessageActivity)
        TwilioApplication.instance.basicClient.chatClient?.users?.subscribedUsers?.forEach {
            it.unsubscribe()
        }
        super.onDestroy()
    }

Expected Behavior

We expect to be able to subscribe to the same user again after some time.

Chat Android SDK

v4.2.3

Android API

Tested on api 26, 28 and 29

rusmonster commented 5 years ago

fixed in v4.2.5