From e323c858ab31240fe1558ff99d3676f9e70298bf Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 19 Oct 2018 14:26:13 +0200 Subject: [PATCH] Fix compilation issue and rename method --- .../im/vector/matrix/android/api/session/room/Room.kt | 6 +++++- .../matrix/android/internal/session/room/DefaultRoom.kt | 2 +- .../android/internal/session/room/DefaultRoomService.kt | 8 ++++---- .../matrix/android/internal/session/room/RoomModule.kt | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/Room.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/Room.kt index 898de8f8..3e2a5396 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/Room.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/Room.kt @@ -1,9 +1,13 @@ package im.vector.matrix.android.api.session.room +import android.arch.lifecycle.LiveData +import android.arch.paging.PagedList +import im.vector.matrix.android.api.session.events.model.Event + interface Room { val roomId: String - + fun liveTimeline(): LiveData> } \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt index f3b7d7ec..a9a73c0b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoom.kt @@ -24,7 +24,7 @@ data class DefaultRoom( private val monarchy by inject() private val boundaryCallback = TimelineBoundaryCallback(paginationRequest, roomId, monarchy, Executors.newSingleThreadExecutor()) - fun events(): LiveData> { + override fun liveTimeline(): LiveData> { val realmDataSourceFactory = monarchy.createDataSourceFactory { realm -> val lastChunk = ChunkEntity.where(realm, roomId).findAll().last() EventEntity.where(realm, lastChunk) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt index 54454421..0a09c7cd 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/DefaultRoomService.kt @@ -5,14 +5,14 @@ import com.zhuinden.monarchy.Monarchy import im.vector.matrix.android.api.session.room.Room import im.vector.matrix.android.api.session.room.RoomService import im.vector.matrix.android.internal.database.model.RoomEntity -import im.vector.matrix.android.internal.database.query.find +import im.vector.matrix.android.internal.database.query.where class DefaultRoomService(private val monarchy: Monarchy) : RoomService { override fun getAllRooms(): List { var rooms: List = emptyList() monarchy.doWithRealm { realm -> - rooms = RoomEntity.find(realm).findAll().map { DefaultRoom(it.roomId) } + rooms = RoomEntity.where(realm).findAll().map { DefaultRoom(it.roomId) } } return rooms } @@ -20,14 +20,14 @@ class DefaultRoomService(private val monarchy: Monarchy) : RoomService { override fun getRoom(roomId: String): Room? { var room: Room? = null monarchy.doWithRealm { realm -> - room = RoomEntity.find(realm, roomId).findFirst()?.let { DefaultRoom(it.roomId) } + room = RoomEntity.where(realm, roomId).findFirst()?.let { DefaultRoom(it.roomId) } } return room } override fun rooms(): LiveData> { return monarchy.findAllMappedWithChanges( - { realm -> RoomEntity.find(realm) }, + { realm -> RoomEntity.where(realm) }, { DefaultRoom(it.roomId) } ) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomModule.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomModule.kt index f355d051..17a50e5e 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomModule.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/RoomModule.kt @@ -18,7 +18,7 @@ class RoomModule : Module { } scope(DefaultSession.SCOPE) { - PaginationRequest(get(), get()) + PaginationRequest(get(), get(), get()) } }.invoke() }