mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-20 08:43:56 +00:00
feat: anilist post confirmation
This commit is contained in:
@@ -176,7 +176,7 @@ object Anilist {
|
||||
"variables" to variables
|
||||
)
|
||||
val headers = mutableMapOf(
|
||||
"Content-Type" to "application/json",
|
||||
"Content-Type" to "application/json; charset=utf-8",
|
||||
"Accept" to "application/json"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.databinding.ActivityMarkdownCreatorBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.openLinkInBrowser
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
@@ -80,16 +81,26 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
||||
toast(getString(R.string.cannot_be_empty))
|
||||
return@setOnClickListener
|
||||
}
|
||||
launchIO {
|
||||
val success = when (type) {
|
||||
"activity" -> Anilist.mutation.postActivity(text)
|
||||
//"review" -> Anilist.mutation.postReview(text)
|
||||
"replyActivity" -> Anilist.mutation.postReply(parentId, text)
|
||||
else -> "Error: Unknown type"
|
||||
AlertDialogBuilder(this).apply {
|
||||
setTitle(R.string.warning)
|
||||
setMessage(R.string.post_to_anilist_warning)
|
||||
setPosButton(R.string.i_understand) {
|
||||
launchIO {
|
||||
val success = when (type) {
|
||||
"activity" -> Anilist.mutation.postActivity(text)
|
||||
//"review" -> Anilist.mutation.postReview(text)
|
||||
"replyActivity" -> Anilist.mutation.postReply(parentId, text)
|
||||
else -> "Error: Unknown type"
|
||||
}
|
||||
toast(success)
|
||||
}
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
toast(success)
|
||||
}
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
setNeutralButton(R.string.open_rules) {
|
||||
openLinkInBrowser("https://anilist.co/forum/thread/14")
|
||||
}
|
||||
setNegButton(R.string.cancel)
|
||||
}.show()
|
||||
}
|
||||
|
||||
binding.editText.requestFocus()
|
||||
|
||||
Reference in New Issue
Block a user