Search in sources :

Example 1 with RaixPushHelper

use of chat.rocket.android.api.RaixPushHelper in project Rocket.Chat.Android by RocketChat.

the class GcmPushRegistrationObserver method registerGcmTokenForServer.

private Task<Void> registerGcmTokenForServer() throws IOException {
    final String gcmToken = getGcmToken(getSenderId());
    final RealmUser currentUser = realmHelper.executeTransactionForRead(realm -> RealmUser.queryCurrentUser(realm).findFirst());
    final String userId = currentUser != null ? currentUser.getId() : null;
    final String pushId = new RocketChatCache(context).getOrCreatePushId();
    return new RaixPushHelper(realmHelper, ddpClientRef).pushUpdate(pushId, gcmToken, userId);
}
Also used : RealmUser(chat.rocket.persistence.realm.models.ddp.RealmUser) RocketChatCache(chat.rocket.android.RocketChatCache) RaixPushHelper(chat.rocket.android.api.RaixPushHelper)

Aggregations

RocketChatCache (chat.rocket.android.RocketChatCache)1 RaixPushHelper (chat.rocket.android.api.RaixPushHelper)1 RealmUser (chat.rocket.persistence.realm.models.ddp.RealmUser)1