mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Make the RoomListRoomSummaryFactory.createPlaceholder and RoomListRoomSummaryFactory.createFakeList functions static ones
This commit is contained in:
+2
-2
@@ -115,7 +115,7 @@ class RoomListDataSource @Inject constructor(
|
|||||||
private suspend fun buildAndEmitAllRooms(roomSummaries: List<RoomSummary>) {
|
private suspend fun buildAndEmitAllRooms(roomSummaries: List<RoomSummary>) {
|
||||||
if (diffCache.isEmpty()) {
|
if (diffCache.isEmpty()) {
|
||||||
_allRooms.emit(
|
_allRooms.emit(
|
||||||
roomListRoomSummaryFactory.createFakeList()
|
RoomListRoomSummaryFactory.createFakeList()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val roomListRoomSummaries = ArrayList<RoomListRoomSummary>()
|
val roomListRoomSummaries = ArrayList<RoomListRoomSummary>()
|
||||||
@@ -135,7 +135,7 @@ class RoomListDataSource @Inject constructor(
|
|||||||
|
|
||||||
private fun buildAndCacheItem(roomSummaries: List<RoomSummary>, index: Int): RoomListRoomSummary? {
|
private fun buildAndCacheItem(roomSummaries: List<RoomSummary>, index: Int): RoomListRoomSummary? {
|
||||||
val roomListRoomSummary = when (val roomSummary = roomSummaries.getOrNull(index)) {
|
val roomListRoomSummary = when (val roomSummary = roomSummaries.getOrNull(index)) {
|
||||||
is RoomSummary.Empty -> roomListRoomSummaryFactory.createPlaceholder(roomSummary.identifier)
|
is RoomSummary.Empty -> RoomListRoomSummaryFactory.createPlaceholder(roomSummary.identifier)
|
||||||
is RoomSummary.Filled -> roomListRoomSummaryFactory.create(roomSummary)
|
is RoomSummary.Filled -> roomListRoomSummaryFactory.create(roomSummary)
|
||||||
null -> null
|
null -> null
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -32,10 +32,11 @@ class RoomListRoomSummaryFactory @Inject constructor(
|
|||||||
private val lastMessageTimestampFormatter: LastMessageTimestampFormatter,
|
private val lastMessageTimestampFormatter: LastMessageTimestampFormatter,
|
||||||
private val roomLastMessageFormatter: RoomLastMessageFormatter,
|
private val roomLastMessageFormatter: RoomLastMessageFormatter,
|
||||||
) {
|
) {
|
||||||
|
companion object {
|
||||||
fun createPlaceholder(id: String): RoomListRoomSummary {
|
fun createPlaceholder(id: String): RoomListRoomSummary {
|
||||||
return RoomListRoomSummary(
|
return RoomListRoomSummary(
|
||||||
id = id,
|
id = id,
|
||||||
roomId = RoomId("!aRoom:domain"),
|
roomId = RoomId(id),
|
||||||
isPlaceholder = true,
|
isPlaceholder = true,
|
||||||
name = "Short name",
|
name = "Short name",
|
||||||
timestamp = "hh:mm",
|
timestamp = "hh:mm",
|
||||||
@@ -55,6 +56,7 @@ class RoomListRoomSummaryFactory @Inject constructor(
|
|||||||
createPlaceholder("!fakeRoom$it:domain")
|
createPlaceholder("!fakeRoom$it:domain")
|
||||||
}.toImmutableList()
|
}.toImmutableList()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun create(roomSummary: RoomSummary.Filled): RoomListRoomSummary {
|
fun create(roomSummary: RoomSummary.Filled): RoomListRoomSummary {
|
||||||
val roomIdentifier = roomSummary.identifier()
|
val roomIdentifier = roomSummary.identifier()
|
||||||
|
|||||||
Reference in New Issue
Block a user