about summary refs log tree commit diff
path: root/src/view/screens/Profile.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/screens/Profile.tsx')
-rw-r--r--src/view/screens/Profile.tsx131
1 files changed, 67 insertions, 64 deletions
diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx
index 88b11b114..5411bc044 100644
--- a/src/view/screens/Profile.tsx
+++ b/src/view/screens/Profile.tsx
@@ -43,82 +43,85 @@ interface SectionRef {
 }
 
 type Props = NativeStackScreenProps<CommonNavigatorParams, 'Profile'>
-export const ProfileScreen = withAuthRequired(function ProfileScreenImpl({
-  route,
-}: Props) {
-  const {currentAccount} = useSession()
-  const name =
-    route.params.name === 'me' ? currentAccount?.did : route.params.name
-  const moderationOpts = useModerationOpts()
-  const {
-    data: resolvedDid,
-    error: resolveError,
-    refetch: refetchDid,
-    isFetching: isFetchingDid,
-  } = useResolveDidQuery(name)
-  const {
-    data: profile,
-    dataUpdatedAt,
-    error: profileError,
-    refetch: refetchProfile,
-    isFetching: isFetchingProfile,
-  } = useProfileQuery({
-    did: resolvedDid?.did,
-  })
+export const ProfileScreen = withAuthRequired(
+  function ProfileScreenImpl({route}: Props) {
+    const {currentAccount} = useSession()
+    const name =
+      route.params.name === 'me' ? currentAccount?.did : route.params.name
+    const moderationOpts = useModerationOpts()
+    const {
+      data: resolvedDid,
+      error: resolveError,
+      refetch: refetchDid,
+      isFetching: isFetchingDid,
+    } = useResolveDidQuery(name)
+    const {
+      data: profile,
+      dataUpdatedAt,
+      error: profileError,
+      refetch: refetchProfile,
+      isFetching: isFetchingProfile,
+    } = useProfileQuery({
+      did: resolvedDid?.did,
+    })
 
-  const onPressTryAgain = React.useCallback(() => {
-    if (resolveError) {
-      refetchDid()
-    } else {
-      refetchProfile()
-    }
-  }, [resolveError, refetchDid, refetchProfile])
+    const onPressTryAgain = React.useCallback(() => {
+      if (resolveError) {
+        refetchDid()
+      } else {
+        refetchProfile()
+      }
+    }, [resolveError, refetchDid, refetchProfile])
 
-  if (isFetchingDid || isFetchingProfile || !moderationOpts) {
-    return (
-      <CenteredView>
-        <ProfileHeader
-          profile={null}
-          moderation={null}
-          isProfilePreview={true}
+    if (isFetchingDid || isFetchingProfile || !moderationOpts) {
+      return (
+        <CenteredView>
+          <ProfileHeader
+            profile={null}
+            moderation={null}
+            isProfilePreview={true}
+          />
+        </CenteredView>
+      )
+    }
+    if (resolveError || profileError) {
+      return (
+        <CenteredView>
+          <ErrorScreen
+            testID="profileErrorScreen"
+            title="Oops!"
+            message={cleanError(resolveError || profileError)}
+            onPressTryAgain={onPressTryAgain}
+          />
+        </CenteredView>
+      )
+    }
+    if (profile && moderationOpts) {
+      return (
+        <ProfileScreenLoaded
+          profile={profile}
+          dataUpdatedAt={dataUpdatedAt}
+          moderationOpts={moderationOpts}
+          hideBackButton={!!route.params.hideBackButton}
         />
-      </CenteredView>
-    )
-  }
-  if (resolveError || profileError) {
+      )
+    }
+    // should never happen
     return (
       <CenteredView>
         <ErrorScreen
           testID="profileErrorScreen"
           title="Oops!"
-          message={cleanError(resolveError || profileError)}
+          message="Something went wrong and we're not sure what."
           onPressTryAgain={onPressTryAgain}
         />
       </CenteredView>
     )
-  }
-  if (profile && moderationOpts) {
-    return (
-      <ProfileScreenLoaded
-        profile={profile}
-        dataUpdatedAt={dataUpdatedAt}
-        moderationOpts={moderationOpts}
-        hideBackButton={!!route.params.hideBackButton}
-      />
-    )
-  }
-  // should never happen
-  return (
-    <CenteredView>
-      <ErrorScreen
-        testID="profileErrorScreen"
-        title="Oops!"
-        message="Something went wrong and we're not sure what."
-        onPressTryAgain={onPressTryAgain}
-      />
-    </CenteredView>
-  )
-})
+  },
+  {
+    isPublic: true,
+  },
+)
 
 function ProfileScreenLoaded({
   profile: profileUnshadowed,