feat: anilist post confirmation
This commit is contained in:
parent
a3b1d3db57
commit
2c521b4ac6
3 changed files with 24 additions and 10 deletions
|
@ -176,7 +176,7 @@ object Anilist {
|
||||||
"variables" to variables
|
"variables" to variables
|
||||||
)
|
)
|
||||||
val headers = mutableMapOf(
|
val headers = mutableMapOf(
|
||||||
"Content-Type" to "application/json",
|
"Content-Type" to "application/json; charset=utf-8",
|
||||||
"Accept" to "application/json"
|
"Accept" to "application/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ani.dantotsu.connections.anilist.Anilist
|
||||||
import ani.dantotsu.databinding.ActivityMarkdownCreatorBinding
|
import ani.dantotsu.databinding.ActivityMarkdownCreatorBinding
|
||||||
import ani.dantotsu.initActivity
|
import ani.dantotsu.initActivity
|
||||||
import ani.dantotsu.navBarHeight
|
import ani.dantotsu.navBarHeight
|
||||||
|
import ani.dantotsu.openLinkInBrowser
|
||||||
import ani.dantotsu.statusBarHeight
|
import ani.dantotsu.statusBarHeight
|
||||||
import ani.dantotsu.themes.ThemeManager
|
import ani.dantotsu.themes.ThemeManager
|
||||||
import ani.dantotsu.toast
|
import ani.dantotsu.toast
|
||||||
|
@ -80,16 +81,26 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
||||||
toast(getString(R.string.cannot_be_empty))
|
toast(getString(R.string.cannot_be_empty))
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
launchIO {
|
AlertDialogBuilder(this).apply {
|
||||||
val success = when (type) {
|
setTitle(R.string.warning)
|
||||||
"activity" -> Anilist.mutation.postActivity(text)
|
setMessage(R.string.post_to_anilist_warning)
|
||||||
//"review" -> Anilist.mutation.postReview(text)
|
setPosButton(R.string.i_understand) {
|
||||||
"replyActivity" -> Anilist.mutation.postReply(parentId, text)
|
launchIO {
|
||||||
else -> "Error: Unknown type"
|
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)
|
setNeutralButton(R.string.open_rules) {
|
||||||
}
|
openLinkInBrowser("https://anilist.co/forum/thread/14")
|
||||||
onBackPressedDispatcher.onBackPressed()
|
}
|
||||||
|
setNegButton(R.string.cancel)
|
||||||
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.editText.requestFocus()
|
binding.editText.requestFocus()
|
||||||
|
|
|
@ -988,4 +988,7 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
||||||
<string name="cannot_be_empty">Text cannot be empty</string>
|
<string name="cannot_be_empty">Text cannot be empty</string>
|
||||||
<string name="reply">Reply</string>
|
<string name="reply">Reply</string>
|
||||||
<string name="replies">Replies</string>
|
<string name="replies">Replies</string>
|
||||||
|
<string name="open_rules">Open Rules</string>
|
||||||
|
<string name="i_understand">I understand</string>
|
||||||
|
<string name="post_to_anilist_warning">By posting to AniList, you agree to the rules and guidelines of AniList</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue