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
app/src/main/java/solutions/tretter/githugandroid/TextEditorDialog.kt
This commit is contained in:
Joe Tretter
2026-05-02 22:04:37 -05:00
parent 17f19ca0ba
commit dcd5589d74
3 changed files with 17 additions and 19 deletions

View File

@@ -323,8 +323,9 @@ fun GitHugApp() {
applyRecommendedPaneWeights(persist = false)
}
fun saveEditor(targetPath: String) {
fun saveEditor() {
val state = editorState ?: return
val targetPath = state.saveAsPath.trim()
if (targetPath.isBlank()) return
val (newRepo, lines) = runtime.writeEditorFile(currentLevel, repo, targetPath, state.content)
editorState = null
@@ -452,18 +453,11 @@ fun GitHugApp() {
state = state,
onContentChange = { editorState = state.copy(content = it) },
onSaveAsPathChange = { editorState = state.copy(saveAsPath = it) },
onCancel = {
onClose = {
output = output + "Editor closed without saving"
editorState = null
},
onSave = { saveEditor(state.path) },
onSaveAs = {
val targetPath = state.saveAsPath.trim()
if (targetPath.isNotEmpty()) {
editorState = state.copy(path = targetPath, saveAsPath = targetPath)
saveEditor(targetPath)
}
},
onSave = { saveEditor() },
)
}
}