Fix (yet another) potential issue with autosave overwriting files

This commit is contained in:
William Brawner 2020-10-08 09:20:57 -07:00
parent 2059d54b3b
commit 84db6b3d80
2 changed files with 5 additions and 3 deletions

View file

@ -40,8 +40,8 @@ android {
applicationId "com.wbrawner.simplemarkdown" applicationId "com.wbrawner.simplemarkdown"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 30 targetSdkVersion 30
versionCode 31 versionCode 32
versionName "0.8.9" versionName "0.8.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false" buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
} }

View file

@ -15,7 +15,7 @@ class MarkdownViewModel : ViewModel() {
val fileName = MutableLiveData<String>("Untitled.md") val fileName = MutableLiveData<String>("Untitled.md")
val markdownUpdates = MutableLiveData<String>() val markdownUpdates = MutableLiveData<String>()
val editorActions = MutableLiveData<EditorAction>() val editorActions = MutableLiveData<EditorAction>()
val uri = MutableLiveData<Uri>() val uri = MutableLiveData<Uri?>()
private val isDirty = AtomicBoolean(false) private val isDirty = AtomicBoolean(false)
fun updateMarkdown(markdown: String?) { fun updateMarkdown(markdown: String?) {
@ -70,7 +70,9 @@ class MarkdownViewModel : ViewModel() {
fun reset(untitledFileName: String) { fun reset(untitledFileName: String) {
fileName.postValue(untitledFileName) fileName.postValue(untitledFileName)
uri.postValue(null)
markdownUpdates.postValue("") markdownUpdates.postValue("")
editorActions.postValue(EditorAction.Load(""))
isDirty.set(false) isDirty.set(false)
} }