fixed search history not showing

This commit is contained in:
deniscerri 2023-05-26 23:41:29 +02:00
parent 601e2db741
commit bfdc7df88a
No known key found for this signature in database
GPG key ID: 95C43D517D830350
2 changed files with 9 additions and 9 deletions

View file

@ -388,15 +388,15 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, OnClickListene
}else{
searchView!!.editText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_plus, 0)
}
val suggestions = if (sharedPreferences!!.getBoolean("search_suggestions", false)){
withContext(Dispatchers.IO){
if (it!!.isEmpty()) {
resultViewModel.getSearchHistory().map { it.query }
}else{
infoUtil!!.getSearchSuggestions(it.toString())
}
val suggestions = withContext(Dispatchers.IO){
if (it!!.isEmpty()) {
resultViewModel.getSearchHistory().map { it.query }
}else if (sharedPreferences!!.getBoolean("search_suggestions", false)){
infoUtil!!.getSearchSuggestions(it.toString())
}else{
emptyList()
}
} else emptyList()
}
if (it!!.isEmpty()){
for (i in suggestions.indices) {

View file

@ -263,7 +263,7 @@
<string name="socks5_proxy_summary">Use the specified HTTP/HTTPS/SOCKS proxy</string>
<string name="socks5_proxy">Socks5 Proxy URL</string>
<string name="search_suggestions">Search Suggestions</string>
<string name="search_suggestions_summary">Get search suggestions from google</string>
<string name="search_suggestions_summary">Get search suggestions from Google</string>
<string name="preferred_format_id_summary">Select the format with this ID in the download card</string>
<string name="misc">Misc</string>
<string name="general">General</string>