feat: comment reporting
This commit is contained in:
parent
a251dd4ffb
commit
55e156579b
6 changed files with 90 additions and 16 deletions
|
@ -66,7 +66,8 @@ class AnimeWatchAdapter(
|
|||
startActivity(
|
||||
fragment.requireContext(),
|
||||
Intent(fragment.requireContext(), CommentsActivity::class.java)
|
||||
.putExtra("mediaId", media.id),
|
||||
.putExtra("mediaId", media.id)
|
||||
.putExtra("mediaName", media.mainName()),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import ani.dantotsu.settings.saving.PrefName
|
|||
import ani.dantotsu.snackString
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import com.xwray.groupie.Section
|
||||
|
||||
import com.xwray.groupie.viewbinding.BindableItem
|
||||
import io.noties.markwon.Markwon
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
@ -127,6 +126,15 @@ class CommentItem(val comment: Comment,
|
|||
}
|
||||
}
|
||||
}
|
||||
viewBinding.commentReport.setOnClickListener {
|
||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
||||
scope.launch {
|
||||
val success = CommentsAPI.reportComment(comment.commentId, comment.username, commentsActivity.mediaName)
|
||||
if (success) {
|
||||
snackString("Comment Reported")
|
||||
}
|
||||
}
|
||||
}
|
||||
//fill the icon if the user has liked the comment
|
||||
setVoteButtons(viewBinding)
|
||||
viewBinding.commentUpVote.setOnClickListener {
|
||||
|
|
|
@ -57,6 +57,7 @@ class CommentsActivity : AppCompatActivity() {
|
|||
private val section = Section()
|
||||
private val adapter = GroupieAdapter()
|
||||
private var mediaId: Int = -1
|
||||
var mediaName: String = ""
|
||||
private var backgroundColor: Int = 0
|
||||
var pagesLoaded = 1
|
||||
var totalPages = 1
|
||||
|
@ -69,6 +70,7 @@ class CommentsActivity : AppCompatActivity() {
|
|||
initActivity(this)
|
||||
//get the media id from the intent
|
||||
val mediaId = intent.getIntExtra("mediaId", -1)
|
||||
mediaName = intent.getStringExtra("mediaName")?:"unknown"
|
||||
if (mediaId == -1) {
|
||||
snackString("Invalid Media ID")
|
||||
finish()
|
||||
|
|
|
@ -72,7 +72,8 @@ class MangaReadAdapter(
|
|||
startActivity(
|
||||
fragment.requireContext(),
|
||||
Intent(fragment.requireContext(), CommentsActivity::class.java)
|
||||
.putExtra("mediaId", media.id),
|
||||
.putExtra("mediaId", media.id)
|
||||
.putExtra("mediaName", media.mainName()),
|
||||
null
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue