Skip to content

Commit

Permalink
fixed a bug where game size could be any number, thanks to @ariantron
Browse files Browse the repository at this point in the history
  • Loading branch information
yamin8000 committed Nov 20, 2022
1 parent 066e284 commit 3e9da35
Show file tree
Hide file tree
Showing 3 changed files with 7 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 @@ -32,8 +32,8 @@ android {
applicationId "io.github.yamin8000.dooz"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.1"
vectorDrawables {
useSupportLibrary true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ class SettingsState(
var gameSize: Int
get() = _gameSize.value
set(value) {
_gameSize.value = value
scope.launch { dataStore.setInt(Constants.gameSize, value) }
if (value in Constants.gameSizeRange) {
_gameSize.value = value
scope.launch { dataStore.setInt(Constants.gameSize, value) }
}
}

var firstPlayerName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Constants {
const val theme = "theme"

const val gameSize = "gameSize"
val gameSizeRange = 3..7

const val gamePlayersType = "gamePlayersType"
const val firstPlayerName = "firstPlayerName"
Expand Down

0 comments on commit 3e9da35

Please sign in to comment.