mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Breadcrumbs: limit number to 20
This commit is contained in:
parent
4ff12605e9
commit
ad4d5e5c02
1 changed files with 4 additions and 1 deletions
|
@ -23,6 +23,9 @@ import im.vector.matrix.android.internal.task.Task
|
|||
import im.vector.matrix.android.internal.util.fetchCopied
|
||||
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> {
|
||||
data class Params(
|
||||
// Last seen roomId
|
||||
|
@ -50,7 +53,7 @@ internal class DefaultUpdateBreadcrumbsTask @Inject constructor(
|
|||
bc.recentRoomIds.remove(params.roomId)
|
||||
// Add the room at first position
|
||||
bc.recentRoomIds.add(0, params.roomId)
|
||||
bc.recentRoomIds.toList()
|
||||
bc.recentRoomIds.take(MAX_BREADCRUMBS_ROOMS_NUMBER)
|
||||
} else {
|
||||
listOf(params.roomId)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue