improve delete

hauntED
yova 4 months ago
parent cddee77017
commit 32de26229d

@ -1,5 +1,5 @@
---
url: https://mary.joefix.it/test-3/
url: https://mary.joefix.it/haunted-intro/
title: hauntED intro
feature_image: https://mary.joefix.it/content/images/size/w1200/2023/11/IMG_20231105_132234.jpg
---
@ -12,7 +12,8 @@ A simple markdown editor for ghost on android. Built with [simple-markdown-edito
- elegant and stressless offline writing
- preview of rendered text
- directly push to [ghost CMS](https://ghost.org/)
- directly push to [ghost CMS](https://ghost.org/). example [here](https://mary.joefix.it/)
- push images to ghost and include as markdown
- send links from other apps to include as markdown syntax
- dark mode

Binary file not shown.

@ -351,18 +351,17 @@ class MainActivity : AppCompatActivity() {
444,
"error".toResponseBody("text/plain".toMediaTypeOrNull())
)
if (metaData.ID == null) {
if (metaData.getId() == null) {
// No ID for URL found
saveFile()
deleteVisible = false
invalidateOptionsMenu()
return false
}
}
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
if (metaData.ID == null) {
if (metaData.getId() == null) {
// No ID for URL found
saveFile()
deleteVisible = false
invalidateOptionsMenu()
return@withContext false
}
}
try {
response = api.postApi.deletePost(metaData.ID!!).execute()
} catch (e:Exception) {
@ -798,28 +797,15 @@ class MainActivity : AppCompatActivity() {
uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION
)
CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) {
if (readFile(uri)) Log.i(javaClass.simpleName, "File opened")
}
if (metaData.metaData.get("url") == null) {
deleteVisible = false
invalidateOptionsMenu()
} else {
deleteVisible = true
invalidateOptionsMenu()
}
this@MainActivity.runOnUiThread({
Toast.makeText(
this@MainActivity,
"File loaded.",
Toast.LENGTH_LONG
).show()
if (mdeValue.equals("")) webView.evaluateJavascript("easyMDE.codemirror.doc.setValue(\"\");") {}
webView.evaluateJavascript("onRead();"){}
})
thisFileUri = uri
saveMetaToSharedPrefs()
if (metaData.metaData.get("url") == null) {
deleteVisible = false
invalidateOptionsMenu()
} else {
deleteVisible = true
invalidateOptionsMenu()
}
}
}

Loading…
Cancel
Save