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:
@@ -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() },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user