Clean some files

This commit is contained in:
ganfra
2018-10-17 19:12:39 +02:00
parent 00188fde29
commit 1646687e6d
6 changed files with 14 additions and 28 deletions

View File

@ -13,9 +13,4 @@ interface Session : RoomService {
@MainThread
fun close()
fun syncThread(): SyncThread
// Visible for testing request directly. Will be deleted
fun realmHolder(): SessionRealmHolder
}

View File

@ -4,4 +4,6 @@ interface Room {
val roomId: String
}

View File

@ -8,6 +8,6 @@ interface RoomService {
fun getAllRooms(): List<Room>
fun observeAllRooms(): LiveData<List<Room>>
fun rooms(): LiveData<List<Room>>
}

View File

@ -47,15 +47,6 @@ class DefaultSession(private val sessionParams: SessionParams
syncThread.start()
}
override fun realmHolder(): SessionRealmHolder {
assert(isOpen)
return realmInstanceHolder
}
override fun syncThread(): SyncThread {
assert(isOpen)
return syncThread
}
@MainThread
override fun close() {
@ -78,8 +69,8 @@ class DefaultSession(private val sessionParams: SessionParams
return roomService.getAllRooms()
}
override fun observeAllRooms(): LiveData<List<Room>> {
return roomService.observeAllRooms()
override fun rooms(): LiveData<List<Room>> {
return roomService.rooms()
}
// Private methods *****************************************************************************

View File

@ -29,7 +29,7 @@ class DefaultRoomService(private val realmConfiguration: RealmConfiguration,
return room
}
override fun observeAllRooms(): LiveData<List<Room>> {
override fun rooms(): LiveData<List<Room>> {
val roomResults = RoomEntity.getAll(mainThreadRealm.instance).findAllAsync()
return RealmLiveData(roomResults) { DefaultRoom(it.roomId) }
}