fixed comments not deleting in the video player

This commit is contained in:
Trevor
2025-07-02 14:40:11 -05:00
parent 24dbb543ae
commit 76ce60d679
2 changed files with 5 additions and 4 deletions
@@ -21,6 +21,7 @@ import com.futo.platformplayer.UIDialogs
import com.futo.platformplayer.activities.PolycentricHomeActivity import com.futo.platformplayer.activities.PolycentricHomeActivity
import com.futo.platformplayer.api.media.models.comments.IPlatformComment 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.PolycentricPlatformComment
import com.futo.platformplayer.api.media.models.comments.LazyComment
import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails import com.futo.platformplayer.api.media.models.video.IPlatformVideoDetails
import com.futo.platformplayer.constructs.TaskHandler import com.futo.platformplayer.constructs.TaskHandler
import com.futo.platformplayer.logging.Logger import com.futo.platformplayer.logging.Logger
@@ -170,8 +171,8 @@ class CommentsFragment : MainFragment() {
return@showConfirmationDialog return@showConfirmationDialog
} }
val index = _comments.indexOf(comment) val index = _comments.indexOfFirst { it == comment || (it is LazyComment && it.getUnderlyingComment() == comment) }
if (index != -1) { if (index >= 0) {
_comments.removeAt(index) _comments.removeAt(index)
_adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index)) _adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index))
@@ -161,8 +161,8 @@ class CommentsList : ConstraintLayout {
return@showConfirmationDialog return@showConfirmationDialog
} }
val index = _comments.indexOf(comment) val index = _comments.indexOfFirst { it == comment || (it is LazyComment && it.getUnderlyingComment() == comment) }
if (index != -1) { if (index >= 0) {
_comments.removeAt(index) _comments.removeAt(index)
_adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index)) _adapterComments.notifyItemRemoved(_adapterComments.childToParentPosition(index))