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 title: hauntED intro
feature_image: https://mary.joefix.it/content/images/size/w1200/2023/11/IMG_20231105_132234.jpg 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 - elegant and stressless offline writing
- preview of rendered text - 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 - push images to ghost and include as markdown
- send links from other apps to include as markdown syntax - send links from other apps to include as markdown syntax
- dark mode - dark mode

Binary file not shown.

@ -351,18 +351,17 @@ class MainActivity : AppCompatActivity() {
444, 444,
"error".toResponseBody("text/plain".toMediaTypeOrNull()) "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 { CoroutineScope(Dispatchers.Main).launch {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
if (metaData.ID == null) {
if (metaData.getId() == null) {
// No ID for URL found
saveFile()
deleteVisible = false
invalidateOptionsMenu()
return@withContext false
}
}
try { try {
response = api.postApi.deletePost(metaData.ID!!).execute() response = api.postApi.deletePost(metaData.ID!!).execute()
} catch (e:Exception) { } catch (e:Exception) {
@ -798,28 +797,15 @@ class MainActivity : AppCompatActivity() {
uri, uri,
Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION
) )
CoroutineScope(Dispatchers.Main).launch { thisFileUri = uri
withContext(Dispatchers.IO) { saveMetaToSharedPrefs()
if (readFile(uri)) Log.i(javaClass.simpleName, "File opened")
} if (metaData.metaData.get("url") == null) {
deleteVisible = false
if (metaData.metaData.get("url") == null) { invalidateOptionsMenu()
deleteVisible = false } else {
invalidateOptionsMenu() deleteVisible = true
} else { invalidateOptionsMenu()
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();"){}
})
} }
} }
} }

Loading…
Cancel
Save