diff --git a/app/src/main/java/com/jerboa/db/AppDB.kt b/app/src/main/java/com/jerboa/db/AppDB.kt index 6405c7b76..dd1078761 100644 --- a/app/src/main/java/com/jerboa/db/AppDB.kt +++ b/app/src/main/java/com/jerboa/db/AppDB.kt @@ -238,8 +238,9 @@ class SearchHistoryRepository( fun history(): Flow> = searchHistoryDao.history() suspend fun insert(item: SearchHistory) { - if (appSettingsDao.settings().first().saveSearchHistory) + if (appSettingsDao.settings().first().saveSearchHistory) { searchHistoryDao.insert(item) + } } suspend fun delete(item: SearchHistory) = searchHistoryDao.delete(item) diff --git a/app/src/main/java/com/jerboa/ui/components/community/list/CommunityListViewModel.kt b/app/src/main/java/com/jerboa/ui/components/community/list/CommunityListViewModel.kt index d41fdff4f..d5f82db36 100644 --- a/app/src/main/java/com/jerboa/ui/components/community/list/CommunityListViewModel.kt +++ b/app/src/main/java/com/jerboa/ui/components/community/list/CommunityListViewModel.kt @@ -29,8 +29,8 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import java.time.Instant -class CommunityListViewModelFactory(private val repository: SearchHistoryRepository) - : ViewModelProvider.Factory { +class CommunityListViewModelFactory(private val repository: SearchHistoryRepository) : + ViewModelProvider.Factory { override fun create(modelClass: Class): T { if (modelClass.isAssignableFrom(CommunityListViewModel::class.java)) { @Suppress("UNCHECKED_CAST")