Skip to content

Commit

Permalink
Update parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
cooltey committed Aug 27, 2024
1 parent 9d7b2a4 commit 4d1191a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface HistoryEntryWithImageDao {
else SearchResults(entries.take(3).map { SearchResult(toHistoryEntry(it).title, SearchResult.SearchResultType.HISTORY) }.toMutableList())
}

fun filterHistoryItemsWithoutTime(searchQuery: String): List<HistoryEntry> {
fun filterHistoryItemsWithoutTime(searchQuery: String = ""): List<HistoryEntry> {
return findEntriesBySearchTerm("%${normalizedQuery(searchQuery)}%").map { toHistoryEntry(it) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class RecommendedContentViewModel(bundle: Bundle) : ViewModel() {

// Get term from last history entry if no article is opened
if (term.isEmpty()) {
term = AppDatabase.instance.historyEntryWithImageDao().findEntriesBySearchTerm("%%").firstOrNull()?.apiTitle ?: ""
term = AppDatabase.instance.historyEntryWithImageDao().filterHistoryItemsWithoutTime().firstOrNull()?.apiTitle ?: ""
}

// Ger term from Because you read if no history entry is found
Expand Down Expand Up @@ -149,7 +149,7 @@ class RecommendedContentViewModel(bundle: Bundle) : ViewModel() {

private suspend fun loadHistoryItems(): List<PageTitle> {
return withContext(Dispatchers.IO) {
AppDatabase.instance.historyEntryWithImageDao().filterHistoryItemsWithoutTime("").map {
AppDatabase.instance.historyEntryWithImageDao().filterHistoryItemsWithoutTime().map {
it.title
}.take(3)
}
Expand Down

0 comments on commit 4d1191a

Please sign in to comment.