Breadcrumbs: limit number to 20
This commit is contained in:
parent
4ff12605e9
commit
ad4d5e5c02
|
@ -23,6 +23,9 @@ import im.vector.matrix.android.internal.task.Task
|
||||||
import im.vector.matrix.android.internal.util.fetchCopied
|
import im.vector.matrix.android.internal.util.fetchCopied
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
// Use same arbitrary value than Riot-Web
|
||||||
|
private const val MAX_BREADCRUMBS_ROOMS_NUMBER = 20
|
||||||
|
|
||||||
internal interface UpdateBreadcrumbsTask : Task<UpdateBreadcrumbsTask.Params, Unit> {
|
internal interface UpdateBreadcrumbsTask : Task<UpdateBreadcrumbsTask.Params, Unit> {
|
||||||
data class Params(
|
data class Params(
|
||||||
// Last seen roomId
|
// Last seen roomId
|
||||||
|
@ -50,7 +53,7 @@ internal class DefaultUpdateBreadcrumbsTask @Inject constructor(
|
||||||
bc.recentRoomIds.remove(params.roomId)
|
bc.recentRoomIds.remove(params.roomId)
|
||||||
// Add the room at first position
|
// Add the room at first position
|
||||||
bc.recentRoomIds.add(0, params.roomId)
|
bc.recentRoomIds.add(0, params.roomId)
|
||||||
bc.recentRoomIds.toList()
|
bc.recentRoomIds.take(MAX_BREADCRUMBS_ROOMS_NUMBER)
|
||||||
} else {
|
} else {
|
||||||
listOf(params.roomId)
|
listOf(params.roomId)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue