Search in sources :

Example 1 with RealmRoom

use of chat.rocket.persistence.realm.models.ddp.RealmRoom in project Rocket.Chat.Android by RocketChat.

the class AbstractRocketChatCacheObserver method updateRoomIdWith.

private void updateRoomIdWith(String roomId) {
    if (!TextUtils.isEmpty(roomId)) {
        RealmRoom room = realmHelper.executeTransactionForRead(realm -> realm.where(RealmRoom.class).equalTo("rid", roomId).findFirst());
        if (room != null) {
            if (this.roomId == null || !this.roomId.equals(roomId)) {
                this.roomId = roomId;
                onRoomIdUpdated(roomId);
            }
            return;
        }
    }
    if (this.roomId != null) {
        this.roomId = null;
        onRoomIdUpdated(null);
    }
}
Also used : RealmRoom(chat.rocket.persistence.realm.models.ddp.RealmRoom)

Aggregations

RealmRoom (chat.rocket.persistence.realm.models.ddp.RealmRoom)1