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/GitHugApp.kt
This commit is contained in:
Joe Tretter
2026-04-24 13:25:56 -05:00
parent adab680cb6
commit 9f2e5b8dd9
2 changed files with 8 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ fun GitHugApp() {
val paneLayoutStore = remember(context) { PaneLayoutStore(context.applicationContext) }
val gameProgressStore = remember(context) { GameProgressStore(context.applicationContext) }
val persistedPaneLayout by paneLayoutStore.layoutFlow.collectAsState(initial = defaultPaneLayout())
val persistedCompletedLevels by gameProgressStore.completedLevelsFlow.collectAsState(initial = emptySet())
val persistedCompletedLevels by gameProgressStore.completedLevelsFlow.collectAsState(initial = null)
val scope = rememberCoroutineScope()
val screenScrollState = rememberScrollState()
val screenHeightDp = configuration.screenHeightDp
@@ -82,17 +82,18 @@ fun GitHugApp() {
}
LaunchedEffect(persistedCompletedLevels) {
completedLevels = persistedCompletedLevels
val restoredCompletedLevels = persistedCompletedLevels ?: return@LaunchedEffect
completedLevels = restoredCompletedLevels
if (!hasRestoredProgress) {
hasRestoredProgress = true
val firstIncompleteIndex = levels.indexOfFirst { it.id !in persistedCompletedLevels }
val firstIncompleteIndex = levels.indexOfFirst { it.id !in restoredCompletedLevels }
val resumeIndex = firstIncompleteIndex.takeIf { it >= 0 } ?: levels.lastIndex
currentLevelIndex = resumeIndex
repo = runtime.prepareLevel(levels[resumeIndex])
output = listOf(
if (persistedCompletedLevels.size == levels.size) {
if (restoredCompletedLevels.size == levels.size) {
"🏁 All Githug levels completed."
} else if (persistedCompletedLevels.isEmpty()) {
} else if (restoredCompletedLevels.isEmpty()) {
runtime.startupBanner()
} else {
"Resumed at level: ${levels[resumeIndex].title}"