Room list : adjust some params
This commit is contained in:
parent
6df8809ee0
commit
0e491af8ab
|
@ -11,7 +11,7 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="8dp"
|
||||||
android:paddingBottom="8dp"
|
android:paddingBottom="8dp"
|
||||||
tools:background="@color/pale_grey">
|
tools:background="@color/pale_grey">
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,15 @@ internal fun EventEntity.Companion.where(realm: Realm,
|
||||||
|
|
||||||
internal fun EventEntity.Companion.latestEvent(realm: Realm,
|
internal fun EventEntity.Companion.latestEvent(realm: Realm,
|
||||||
roomId: String,
|
roomId: String,
|
||||||
|
includedTypes: List<String> = emptyList(),
|
||||||
excludedTypes: List<String> = emptyList()): EventEntity? {
|
excludedTypes: List<String> = emptyList()): EventEntity? {
|
||||||
val query = ChunkEntity.findLastLiveChunkFromRoom(realm, roomId)?.events?.where()
|
val query = ChunkEntity.findLastLiveChunkFromRoom(realm, roomId)?.events?.where()
|
||||||
|
if (includedTypes.isNotEmpty()) {
|
||||||
|
query?.`in`(EventEntityFields.TYPE, includedTypes.toTypedArray())
|
||||||
|
} else if (excludedTypes.isNotEmpty()) {
|
||||||
|
query?.not()?.`in`(EventEntityFields.TYPE, excludedTypes.toTypedArray())
|
||||||
|
}
|
||||||
return query
|
return query
|
||||||
?.not()?.`in`(EventEntityFields.TYPE, excludedTypes.toTypedArray())
|
|
||||||
?.sort(EventEntityFields.DISPLAY_INDEX)
|
?.sort(EventEntityFields.DISPLAY_INDEX)
|
||||||
?.findFirst()
|
?.findFirst()
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ internal class RoomSummaryUpdater(monarchy: Monarchy,
|
||||||
val roomSummary = RoomSummaryEntity.where(realm, roomId).findFirst()
|
val roomSummary = RoomSummaryEntity.where(realm, roomId).findFirst()
|
||||||
?: realm.createObject(roomId)
|
?: realm.createObject(roomId)
|
||||||
|
|
||||||
val lastEvent = EventEntity.latestEvent(realm, roomId)
|
val lastEvent = EventEntity.latestEvent(realm, roomId, includedTypes = listOf(EventType.MESSAGE))
|
||||||
val lastTopicEvent = EventEntity.where(realm, roomId, EventType.STATE_ROOM_TOPIC).last()?.asDomain()
|
val lastTopicEvent = EventEntity.where(realm, roomId, EventType.STATE_ROOM_TOPIC).last()?.asDomain()
|
||||||
|
|
||||||
val otherRoomMembers = RoomMembers(realm, roomId).getLoaded().filterKeys { it != credentials.userId }
|
val otherRoomMembers = RoomMembers(realm, roomId).getLoaded().filterKeys { it != credentials.userId }
|
||||||
|
|
Loading…
Reference in New Issue