Search in sources :

Example 1 with StreamNotifyUserSubscriptionsChanged

use of chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged in project Rocket.Chat.Android by RocketChat.

the class CurrentUserObserver method onLogin.

@DebugLog
private void onLogin(RealmUser user) {
    if (listeners != null) {
        onLogout();
    }
    listeners = new ArrayList<>();
    final String userId = user.getId();
    // get and observe Room subscriptions.
    methodCall.getRoomSubscriptions().onSuccess(task -> {
        if (listeners != null) {
            Registrable listener = new StreamNotifyUserSubscriptionsChanged(context, hostname, realmHelper, ddpClientRef, userId);
            listener.register();
            listeners.add(listener);
        }
        return null;
    }).continueWith(new LogIfError());
}
Also used : Context(android.content.Context) StreamNotifyUserSubscriptionsChanged(chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged) Realm(io.realm.Realm) RealmUser(chat.rocket.persistence.realm.models.ddp.RealmUser) RealmResults(io.realm.RealmResults) LogIfError(chat.rocket.android.helper.LogIfError) DebugLog(hugo.weaving.DebugLog) ArrayList(java.util.ArrayList) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) List(java.util.List) Registrable(chat.rocket.android.service.Registrable) RealmHelper(chat.rocket.persistence.realm.RealmHelper) DDPClientRef(chat.rocket.android.service.DDPClientRef) Registrable(chat.rocket.android.service.Registrable) StreamNotifyUserSubscriptionsChanged(chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged) LogIfError(chat.rocket.android.helper.LogIfError) DebugLog(hugo.weaving.DebugLog)

Aggregations

Context (android.content.Context)1 MethodCallHelper (chat.rocket.android.api.MethodCallHelper)1 LogIfError (chat.rocket.android.helper.LogIfError)1 DDPClientRef (chat.rocket.android.service.DDPClientRef)1 Registrable (chat.rocket.android.service.Registrable)1 StreamNotifyUserSubscriptionsChanged (chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged)1 RealmHelper (chat.rocket.persistence.realm.RealmHelper)1 RealmUser (chat.rocket.persistence.realm.models.ddp.RealmUser)1 DebugLog (hugo.weaving.DebugLog)1 Realm (io.realm.Realm)1 RealmResults (io.realm.RealmResults)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1