feat: anilist notifications (real)

This commit is contained in:
rebelonion 2024-03-14 06:00:48 -05:00
parent 19697f4f39
commit 4d2a08c258
12 changed files with 390 additions and 95 deletions

View file

@ -129,12 +129,12 @@ class CommentItem(val comment: Comment,
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE
viewBinding.commentDelete.setOnClickListener {
dialogBuilder("Delete Comment", "Are you sure you want to delete this comment?") {
dialogBuilder("Delete CommentNotificationWorker", "Are you sure you want to delete this comment?") {
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
scope.launch {
val success = CommentsAPI.deleteComment(comment.commentId)
if (success) {
snackString("Comment Deleted")
snackString("CommentNotificationWorker Deleted")
parentSection.remove(this@CommentItem)
}
}
@ -152,12 +152,12 @@ class CommentItem(val comment: Comment,
}
}
viewBinding.commentReport.setOnClickListener {
dialogBuilder("Report Comment", "Only report comments that violate the rules. Are you sure you want to report this comment?") {
dialogBuilder("Report CommentNotificationWorker", "Only report comments that violate the rules. Are you sure you want to report this comment?") {
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
scope.launch {
val success = CommentsAPI.reportComment(comment.commentId, comment.username, commentsFragment.mediaName, comment.userId)
if (success) {
snackString("Comment Reported")
snackString("CommentNotificationWorker Reported")
}
}
}

View file

@ -270,7 +270,7 @@ class CommentsFragment : Fragment() {
}
//adds additional comments to the section
private suspend fun updateUIWithComment(comment: Comment) {
private suspend fun updateUIWithComment(comment: CommentNotificationWorker) {
withContext(Dispatchers.Main) {
section.add(
CommentItem(
@ -297,7 +297,7 @@ class CommentsFragment : Fragment() {
override fun afterTextChanged(s: android.text.Editable?) {
if (binding.commentInput.text.length > 300) {
binding.commentInput.text.delete(300, binding.commentInput.text.length)
snackString("Comment cannot be longer than 300 characters")
snackString("CommentNotificationWorker cannot be longer than 300 characters")
}
}
})
@ -626,7 +626,7 @@ class CommentsFragment : Fragment() {
private fun processComment() {
val commentText = binding.commentInput.text.toString()
if (commentText.isEmpty()) {
snackString("Comment cannot be empty")
snackString("CommentNotificationWorker cannot be empty")
return
}
@ -662,7 +662,7 @@ class CommentsFragment : Fragment() {
groups.forEach { item ->
if (item is CommentItem && item.comment.commentId == commentWithInteraction?.comment?.commentId) {
updateCommentItem(item, commentText)
snackString("Comment edited")
snackString("CommentNotificationWorker edited")
}
}
}