Skip to content

Commit

Permalink
#52 possible bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Dec 24, 2023
1 parent 24e774c commit 1e0d420
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
applicationId "io.github.yamin8000.owl"
minSdk 21
targetSdk 34
versionCode 31
versionName "1.5.5"
versionCode 32
versionName "1.5.6"
vectorDrawables {
useSupportLibrary true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.util.Locale

private const val FREE = "free"

class HomeState(
val listState: ScrollState,
val isSearching: MutableState<Boolean>,
Expand Down Expand Up @@ -103,7 +105,7 @@ class HomeState(
isVibrating.value = dataStore.getBool(Constants.IS_VIBRATING) ?: true
val isBlank = dataStore.getBool(Constants.IS_STARTING_BLANK) ?: true
if (!isBlank) {
searchText.value = "free"
searchText.value = FREE
searchForDefinition()
}
}
Expand Down Expand Up @@ -287,7 +289,7 @@ class HomeState(
.toMutableSet()

private suspend fun getNewRandomWord(): String {
return db.entryDao().getAll().map { it.word }.shuffled().first()
return db.entryDao().getAll().map { it.word }.shuffled().firstOrNull() ?: FREE
}

suspend fun addToFavourite(
Expand Down

0 comments on commit 1e0d420

Please sign in to comment.