Merge branch 'ts/polycentric-moderation' of gitlab.futo.org:videostreaming/grayjay into ts/polycentric-moderation

This commit is contained in:
Koen J
2025-07-08 16:30:49 +02:00
5 changed files with 26 additions and 6 deletions
@@ -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))
@@ -49,6 +49,7 @@ import com.futo.platformplayer.stores.FragmentedStorage
import com.futo.platformplayer.stores.v2.ManagedStore
import com.futo.platformplayer.views.ToastView
import com.futo.polycentric.core.ApiMethods
import com.futo.polycentric.core.toBase64Url
import kotlinx.coroutines.*
import java.io.File
import java.util.*
@@ -389,7 +390,14 @@ class StateApp {
try {
ModerationsManager.getInstance().getCurrentModerationLevels()
} catch (e: IllegalStateException) {
// Handle case where manager might not be ready, though it should be here
null
}
}
ApiMethods.setModerationExemptSystemProvider {
try {
StatePolycentric.instance.processHandle?.system?.toProto()?.toByteArray()?.toBase64Url()
} catch (e: Throwable) {
null
}
}
@@ -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))
@@ -48,6 +48,17 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- BEGIN BLURB -->
<TextView
android:id="@+id/text_moderation_blurb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="A lower slider value hides more content. Posts or comments with a tag level ABOVE your selected value will be hidden. (Level 0 = most strict, Level 3 = allow everything)"
android:textColor="?attr/colorOnSurface"
android:textSize="14sp" />
<!-- END BLURB -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"