Auto-commit after successful build: update app gameplay/UI, improve build setup
Changed files:\napp/build.gradle.kts app/src/main/java/solutions/tretter/githugandroid/GameModels.kt app/src/main/java/solutions/tretter/githugandroid/levels/CoreLevels.kt
This commit is contained in:
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId = "solutions.tretter.githugandroid"
|
applicationId = "solutions.tretter.githugandroid"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 74
|
versionCode = 75
|
||||||
versionName = "0.1.73"
|
versionName = "0.1.74"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ data class RepoState(
|
|||||||
val currentDir: String = ".",
|
val currentDir: String = ".",
|
||||||
val tags: List<String> = emptyList(),
|
val tags: List<String> = emptyList(),
|
||||||
val remotes: Map<String, String> = emptyMap(),
|
val remotes: Map<String, String> = emptyMap(),
|
||||||
|
val config: Map<String, String> = emptyMap(),
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Level(
|
data class Level(
|
||||||
@@ -53,6 +54,7 @@ val RepoStateSaver = listSaver<RepoState, Any>(
|
|||||||
state.currentDir,
|
state.currentDir,
|
||||||
state.tags,
|
state.tags,
|
||||||
state.remotes.flatMap { listOf(it.key, it.value) },
|
state.remotes.flatMap { listOf(it.key, it.value) },
|
||||||
|
state.config.flatMap { listOf(it.key, it.value) },
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
restore = { saved ->
|
restore = { saved ->
|
||||||
@@ -63,6 +65,7 @@ val RepoStateSaver = listSaver<RepoState, Any>(
|
|||||||
val branchParts = saved[4] as List<*>
|
val branchParts = saved[4] as List<*>
|
||||||
val tags = saved[6] as List<*>
|
val tags = saved[6] as List<*>
|
||||||
val remoteParts = saved[7] as List<*>
|
val remoteParts = saved[7] as List<*>
|
||||||
|
val configParts = saved.getOrNull(8) as? List<*> ?: emptyList<Any>()
|
||||||
RepoState(
|
RepoState(
|
||||||
initialized = initialized,
|
initialized = initialized,
|
||||||
headBranch = headBranch,
|
headBranch = headBranch,
|
||||||
@@ -81,6 +84,7 @@ val RepoStateSaver = listSaver<RepoState, Any>(
|
|||||||
currentDir = saved[5] as String,
|
currentDir = saved[5] as String,
|
||||||
tags = tags.filterIsInstance<String>(),
|
tags = tags.filterIsInstance<String>(),
|
||||||
remotes = remoteParts.chunked(2).associate { (it[0] as String) to (it[1] as String) },
|
remotes = remoteParts.chunked(2).associate { (it[0] as String) to (it[1] as String) },
|
||||||
|
config = configParts.chunked(2).associate { (it[0] as String) to (it[1] as String) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -117,6 +121,11 @@ object GitSandboxEngine {
|
|||||||
!repo.initialized -> repo to listOf("fatal: not a git repository")
|
!repo.initialized -> repo to listOf("fatal: not a git repository")
|
||||||
parts.size >= 2 && parts[1] == "help" -> repo to commandReferenceLines()
|
parts.size >= 2 && parts[1] == "help" -> repo to commandReferenceLines()
|
||||||
parts.size >= 2 && parts[1] == "status" -> repo to statusLines(repo)
|
parts.size >= 2 && parts[1] == "status" -> repo to statusLines(repo)
|
||||||
|
parts.size >= 4 && parts[1] == "config" -> {
|
||||||
|
val key = parts[2]
|
||||||
|
val value = parts.drop(3).joinToString(" ")
|
||||||
|
repo.copy(config = repo.config + (key to value)) to emptyList()
|
||||||
|
}
|
||||||
parts.size >= 3 && parts[1] == "add" -> {
|
parts.size >= 3 && parts[1] == "add" -> {
|
||||||
val target = parts[2]
|
val target = parts[2]
|
||||||
if (target != "." && repo.files.none { it.name == target }) {
|
if (target != "." && repo.files.none { it.name == target }) {
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ internal fun coreLevels(): List<Level> = listOf(
|
|||||||
hints = listOf("Use `git config user.name ...` and `git config user.email ...`."),
|
hints = listOf("Use `git config user.name ...` and `git config user.email ...`."),
|
||||||
commandSuggestions = listOf("git config user.name GitHug", "git config user.email githug@example.com"),
|
commandSuggestions = listOf("git config user.name GitHug", "git config user.email githug@example.com"),
|
||||||
setup = { RepoState(initialized = true, branches = mapOf("master" to 0)) },
|
setup = { RepoState(initialized = true, branches = mapOf("master" to 0)) },
|
||||||
validator = repoPredicate { it.initialized },
|
validator = repoPredicate { repo ->
|
||||||
|
repo.config["user.name"] == "GitHug" && repo.config["user.email"] == "githug@example.com"
|
||||||
|
},
|
||||||
),
|
),
|
||||||
level(
|
level(
|
||||||
id = "add",
|
id = "add",
|
||||||
|
|||||||
Reference in New Issue
Block a user