2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/20425: Do not show recent bookmarks older than 10 days.

This commit is contained in:
mcarare 2021-07-23 19:14:41 +03:00 committed by mergify[bot]
parent ff3191f966
commit bb27316944

View File

@ -8,6 +8,7 @@ import androidx.annotation.WorkerThread
import mozilla.appservices.places.BookmarkRoot
import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.concept.storage.BookmarksStorage
import java.util.concurrent.TimeUnit
/**
* Use cases that allow for modifying and retrieving bookmarks.
@ -47,7 +48,10 @@ class BookmarksUseCase(storage: BookmarksStorage) {
*/
@WorkerThread
suspend operator fun invoke(count: Int = DEFAULT_BOOKMARKS_TO_RETRIEVE): List<BookmarkNode> {
return storage.getRecentBookmarks(count)
return storage.getRecentBookmarks(
count,
TimeUnit.DAYS.toMillis(DEFAULT_BOOKMARKS_DAYS_AGE_TO_RETRIEVE)
)
}
}
@ -56,5 +60,6 @@ class BookmarksUseCase(storage: BookmarksStorage) {
companion object {
const val DEFAULT_BOOKMARKS_TO_RETRIEVE = 4
const val DEFAULT_BOOKMARKS_DAYS_AGE_TO_RETRIEVE = 10L
}
}