From 76ce60d679bdba5b173fa888adc793d9fc967558 Mon Sep 17 00:00:00 2001 From: Trevor Date: Wed, 2 Jul 2025 14:40:11 -0500 Subject: [PATCH] fixed comments not deleting in the video player --- .../fragment/mainactivity/main/CommentsFragment.kt | 5 +++-- .../com/futo/platformplayer/views/segments/CommentsList.kt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/CommentsFragment.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/CommentsFragment.kt index 0dae227d..7558d2e2 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/CommentsFragment.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/CommentsFragment.kt @@ -21,6 +21,7 @@ import com.futo.platformplayer.UIDialogs import com.futo.platformplayer.activities.PolycentricHomeActivity import com.futo.platformplayer.api.media.models.comments.IPlatformComment import com.futo.platformplayer.api.media.models.comments.PolycentricPlatformComment +import com.futo.platformplayer.api.media.models.comments.LazyComment import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails import com.futo.platformplayer.constructs.TaskHandler import com.futo.platformplayer.logging.Logger @@ -170,8 +171,8 @@ class CommentsFragment : MainFragment() { return@showConfirmationDialog } - val index = _comments.indexOf(comment) - if (index != -1) { + val index = _comments.indexOfFirst { it == comment || (it is LazyComment && it.getUnderlyingComment() == comment) } + if (index >= 0) { _comments.removeAt(index) _adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index)) diff --git a/app/src/main/java/com/futo/platformplayer/views/segments/CommentsList.kt b/app/src/main/java/com/futo/platformplayer/views/segments/CommentsList.kt index a1ccd142..a99eb1ff 100644 --- a/app/src/main/java/com/futo/platformplayer/views/segments/CommentsList.kt +++ b/app/src/main/java/com/futo/platformplayer/views/segments/CommentsList.kt @@ -161,8 +161,8 @@ class CommentsList : ConstraintLayout { return@showConfirmationDialog } - val index = _comments.indexOf(comment) - if (index != -1) { + val index = _comments.indexOfFirst { it == comment || (it is LazyComment && it.getUnderlyingComment() == comment) } + if (index >= 0) { _comments.removeAt(index) _adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index))