use of chat.rocket.android.helper.LogIfError in project Rocket.Chat.Android by RocketChat.
the class TokenLoginObserver method onUpdateResults.
@Override
public void onUpdateResults(List<RealmSession> results) {
if (results.isEmpty()) {
return;
}
RealmSession session = results.get(0);
methodCall.loginWithToken(session.getToken()).continueWith(new LogIfError());
}
use of chat.rocket.android.helper.LogIfError in project Rocket.Chat.Android by RocketChat.
the class AbstractDDPDocEventSubscriber method unregister.
@Override
public final void unregister() {
isUnsubscribed = true;
onUnregister();
if (rxSubscription != null) {
rxSubscription.dispose();
}
if (!TextUtils.isEmpty(subscriptionId)) {
ddpClientRef.get().unsubscribe(subscriptionId).continueWith(new LogIfError());
}
}
use of chat.rocket.android.helper.LogIfError in project Rocket.Chat.Android by RocketChat.
the class AbstractDDPDocEventSubscriber method register.
@Override
public final void register() {
isUnsubscribed = false;
JSONArray params = null;
try {
params = getSubscriptionParams();
} catch (JSONException exception) {
// just ignore.
}
ddpClientRef.get().subscribe(getSubscriptionName(), params).onSuccess(task -> {
if (isUnsubscribed) {
ddpClientRef.get().unsubscribe(task.getResult().id).continueWith(new LogIfError());
} else {
subscriptionId = task.getResult().id;
}
return null;
}).continueWith(task -> {
if (task.isFaulted()) {
RCLog.w(task.getError(), "DDP subscription failed.");
}
return null;
});
if (shouldTruncateTableOnInitialize()) {
realmHelper.executeTransaction(realm -> {
realm.delete(getModelClass());
return null;
}).onSuccess(task -> {
rxSubscription = subscribe();
return null;
}).continueWith(new LogIfError());
} else {
rxSubscription = subscribe();
}
onRegister();
}
use of chat.rocket.android.helper.LogIfError in project Rocket.Chat.Android by RocketChat.
the class SessionObserver method onLogin.
@DebugLog
private void onLogin() {
streamNotifyMessage.register();
// update push info
pushHelper.pushSetUser(new RocketChatCache(context).getOrCreatePushId()).continueWith(new LogIfError());
}
use of chat.rocket.android.helper.LogIfError 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());
}
Aggregations