diff --git a/Readme.md b/Readme.md index ab9a6d4..17b5c43 100644 --- a/Readme.md +++ b/Readme.md @@ -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 diff --git a/app/release/app-release.apk b/app/release/app-release.apk index 3bb1315..e3439b1 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/src/main/java/org/wntr/mdeditor/MainActivity.kt b/app/src/main/java/org/wntr/mdeditor/MainActivity.kt index 7b4e75b..7e3db00 100644 --- a/app/src/main/java/org/wntr/mdeditor/MainActivity.kt +++ b/app/src/main/java/org/wntr/mdeditor/MainActivity.kt @@ -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() } } }