diff --git a/src/screens/Profile/Header/Handle.tsx b/src/screens/Profile/Header/Handle.tsx
index 53961c961d..ea3272b14c 100644
--- a/src/screens/Profile/Header/Handle.tsx
+++ b/src/screens/Profile/Header/Handle.tsx
@@ -43,13 +43,6 @@ export function ProfileHeaderHandle({
]}>
{invalidHandle ? ā Invalid Handle : `@${profile.handle}`}
- {profile.associated?.modservice ? (
-
-
- Moderation service
-
-
- ) : undefined}
)
}
diff --git a/src/screens/Profile/Header/index.tsx b/src/screens/Profile/Header/index.tsx
index 70f655e46a..a2daf31b0b 100644
--- a/src/screens/Profile/Header/index.tsx
+++ b/src/screens/Profile/Header/index.tsx
@@ -42,12 +42,12 @@ interface Props {
}
let ProfileHeader = (props: Props): React.ReactNode => {
- if (props.profile.associated?.modservice) {
- if (!props.modservice) {
- return
- }
- return
- }
+ // if (props.profile.associated?.modservice) {
+ // if (!props.modservice) {
+ // return
+ // }
+ // return
+ // }
return
}
ProfileHeader = memo(ProfileHeader)
diff --git a/src/screens/Profile/Sections/ContentFilters.tsx b/src/screens/Profile/Sections/ContentFilters.tsx
index a1def38a44..31e678cff7 100644
--- a/src/screens/Profile/Sections/ContentFilters.tsx
+++ b/src/screens/Profile/Sections/ContentFilters.tsx
@@ -5,13 +5,15 @@ import {Trans, msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useSafeAreaFrame} from 'react-native-safe-area-context'
-import {useSetTitle} from '#/lib/hooks/useSetTitle'
+import {useModServiceSubscriptionMutation} from '#/state/queries/modservice'
import {getLabelGroupsFromLabels} from '#/lib/moderation'
+import {logger} from '#/logger'
import {useTheme, atoms as a} from '#/alf'
import {Text} from '#/components/Typography'
import {Loader} from '#/components/Loader'
import {Divider} from '#/components/Divider'
+import {Button, ButtonText} from '#/components/Button'
import {CenteredView, ScrollView} from '#/view/com/util/Views'
import {ErrorState} from '../ErrorState'
import {ModerationLabelPref} from '#/components/ModerationLabelPref'
@@ -72,6 +74,7 @@ export function ProfileContentFiltersSectionInner({
moderationOpts: ModerationOpts
modservice: AppBskyModerationDefs.ModServiceViewDetailed
}) {
+ const {_} = useLingui()
const t = useTheme()
const groups = React.useMemo(() => {
return getLabelGroupsFromLabels(modservice.policies.labelValues).filter(
@@ -83,8 +86,25 @@ export function ProfileContentFiltersSectionInner({
mod => mod.did === modservice.creator.did && mod.enabled,
),
)
+ const hasSession = true // TODO
- useSetTitle(modservice.creator.displayName || modservice.creator.handle)
+ const {mutateAsync: toggleSubscription, variables} =
+ useModServiceSubscriptionMutation()
+ const isSubscribed =
+ variables?.subscribe ??
+ moderationOpts.mods.find(mod => mod.did === modservice.creator.did)
+
+ const onPressSubscribe = React.useCallback(async () => {
+ try {
+ await toggleSubscription({
+ did: modservice.creator.did,
+ subscribe: !isSubscribed,
+ })
+ } catch (e: any) {
+ // setSubscriptionError(e.message)
+ logger.error(`Failed to subscribe to labeler`, {message: e.message})
+ }
+ }, [toggleSubscription, isSubscribed, modservice])
return (
-
- This service labels the following types of content.
-
+
+
+
+
+ Labels are annotations on users and content. They can be used to
+ hide, warn, and categorize the network.
+
+
+ {!isSubscribed && (
+
+
+ Subscribe to use these labels from @{modservice.creator.handle}:
+
+
+ )}
+
+
+
+
+
0)
const showListsTab =
@@ -490,12 +489,12 @@ function ProfileScreenLoadedV2({
const sectionTitles = useMemo(() => {
return [
- showFiltersTab ? _(msg`Content filters`) : undefined,
showPostsTab ? _(msg`Posts`) : undefined,
showRepliesTab ? _(msg`Replies`) : undefined,
showMediaTab ? _(msg`Media`) : undefined,
showLikesTab ? _(msg`Likes`) : undefined,
showFeedsTab ? _(msg`Feeds`) : undefined,
+ showFiltersTab ? _(msg`Labels`) : undefined,
showListsTab ? _(msg`Lists`) : undefined,
].filter(Boolean) as string[]
}, [
@@ -511,9 +510,6 @@ function ProfileScreenLoadedV2({
let nextIndex = 0
let filtersIndex: number | null = null
- if (showFiltersTab) {
- filtersIndex = nextIndex++
- }
let postsIndex: number | null = null
if (showPostsTab) {
postsIndex = nextIndex++
@@ -534,6 +530,9 @@ function ProfileScreenLoadedV2({
if (showFeedsTab) {
feedsIndex = nextIndex++
}
+ if (showFiltersTab) {
+ filtersIndex = nextIndex++
+ }
let listsIndex: number | null = null
if (showListsTab) {
listsIndex = nextIndex++
@@ -651,18 +650,6 @@ function ProfileScreenLoadedV2({
onPageSelected={onPageSelected}
onCurrentPageSelected={onCurrentPageSelected}
renderHeader={renderHeader}>
- {showFiltersTab
- ? ({headerHeight, isFocused, scrollElRef}) => (
-
- )
- : null}
{showPostsTab
? ({headerHeight, isFocused, scrollElRef}) => (
)
: null}
+ {showFiltersTab
+ ? ({headerHeight, isFocused, scrollElRef}) => (
+
+ )
+ : null}
{showListsTab
? ({headerHeight, isFocused, scrollElRef}) => (