mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-04 07:09:53 +00:00
Added support for comment deletion.
This commit is contained in:
parent
1db4d427fc
commit
c806ff2e33
2 changed files with 48 additions and 44 deletions
|
@ -154,9 +154,10 @@ class CommentsFragment : MainFragment() {
|
|||
}
|
||||
|
||||
private fun onDelete(comment: IPlatformComment) {
|
||||
val processHandle = StatePolycentric.instance.processHandle ?: return
|
||||
UIDialogs.showConfirmationDialog(context, "Are you sure you want to delete this comment?", {
|
||||
val processHandle = StatePolycentric.instance.processHandle ?: return@showConfirmationDialog
|
||||
if (comment !is PolycentricPlatformComment) {
|
||||
return
|
||||
return@showConfirmationDialog
|
||||
}
|
||||
|
||||
val index = _comments.indexOf(comment)
|
||||
|
@ -169,7 +170,7 @@ class CommentsFragment : MainFragment() {
|
|||
processHandle.delete(comment.eventPointer.process, comment.eventPointer.logicalClock)
|
||||
} catch (e: Throwable) {
|
||||
Logger.e(TAG, "Failed to delete event.", e);
|
||||
return@launch;
|
||||
return@launch
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -181,6 +182,7 @@ class CommentsFragment : MainFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun onBackPressed(): Boolean {
|
||||
|
|
|
@ -111,9 +111,10 @@ class CommentsList : ConstraintLayout {
|
|||
}
|
||||
|
||||
private fun onDelete(comment: IPlatformComment) {
|
||||
val processHandle = StatePolycentric.instance.processHandle ?: return
|
||||
UIDialogs.showConfirmationDialog(context, "Are you sure you want to delete this comment?", {
|
||||
val processHandle = StatePolycentric.instance.processHandle ?: return@showConfirmationDialog
|
||||
if (comment !is PolycentricPlatformComment) {
|
||||
return
|
||||
return@showConfirmationDialog
|
||||
}
|
||||
|
||||
val index = _comments.indexOf(comment)
|
||||
|
@ -138,6 +139,7 @@ class CommentsList : ConstraintLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun onScrolled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue