about summary refs log tree commit diff
path: root/src/view/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/screens')
-rw-r--r--src/view/screens/Profile.tsx6
-rw-r--r--src/view/screens/Settings/DisableEmail2FADialog.tsx8
-rw-r--r--src/view/screens/Settings/Email2FAToggle.tsx8
-rw-r--r--src/view/screens/Settings/ExportCarDialog.tsx5
4 files changed, 13 insertions, 14 deletions
diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx
index 4fa46a4cf..734230c6c 100644
--- a/src/view/screens/Profile.tsx
+++ b/src/view/screens/Profile.tsx
@@ -470,7 +470,7 @@ function ProfileScreenLoaded({
 }
 
 function useRichText(text: string): [RichTextAPI, boolean] {
-  const {getAgent} = useAgent()
+  const agent = useAgent()
   const [prevText, setPrevText] = React.useState(text)
   const [rawRT, setRawRT] = React.useState(() => new RichTextAPI({text}))
   const [resolvedRT, setResolvedRT] = React.useState<RichTextAPI | null>(null)
@@ -485,7 +485,7 @@ function useRichText(text: string): [RichTextAPI, boolean] {
     async function resolveRTFacets() {
       // new each time
       const resolvedRT = new RichTextAPI({text})
-      await resolvedRT.detectFacets(getAgent())
+      await resolvedRT.detectFacets(agent)
       if (!ignore) {
         setResolvedRT(resolvedRT)
       }
@@ -494,7 +494,7 @@ function useRichText(text: string): [RichTextAPI, boolean] {
     return () => {
       ignore = true
     }
-  }, [text, getAgent])
+  }, [text, agent])
   const isResolving = resolvedRT === null
   return [resolvedRT ?? rawRT, isResolving]
 }
diff --git a/src/view/screens/Settings/DisableEmail2FADialog.tsx b/src/view/screens/Settings/DisableEmail2FADialog.tsx
index b52dcc7a3..a27cff9a3 100644
--- a/src/view/screens/Settings/DisableEmail2FADialog.tsx
+++ b/src/view/screens/Settings/DisableEmail2FADialog.tsx
@@ -30,7 +30,7 @@ export function DisableEmail2FADialog({
   const t = useTheme()
   const {gtMobile} = useBreakpoints()
   const {currentAccount} = useSession()
-  const {getAgent} = useAgent()
+  const agent = useAgent()
 
   const [stage, setStage] = useState<Stages>(Stages.Email)
   const [confirmationCode, setConfirmationCode] = useState<string>('')
@@ -41,7 +41,7 @@ export function DisableEmail2FADialog({
     setError('')
     setIsProcessing(true)
     try {
-      await getAgent().com.atproto.server.requestEmailUpdate()
+      await agent.com.atproto.server.requestEmailUpdate()
       setStage(Stages.ConfirmCode)
     } catch (e) {
       setError(cleanError(String(e)))
@@ -55,12 +55,12 @@ export function DisableEmail2FADialog({
     setIsProcessing(true)
     try {
       if (currentAccount?.email) {
-        await getAgent().com.atproto.server.updateEmail({
+        await agent.com.atproto.server.updateEmail({
           email: currentAccount!.email,
           token: confirmationCode.trim(),
           emailAuthFactor: false,
         })
-        await getAgent().resumeSession(getAgent().session!)
+        await agent.resumeSession(agent.session!)
         Toast.show(_(msg`Email 2FA disabled`))
       }
       control.close()
diff --git a/src/view/screens/Settings/Email2FAToggle.tsx b/src/view/screens/Settings/Email2FAToggle.tsx
index efeb7e4d7..b5e7adddb 100644
--- a/src/view/screens/Settings/Email2FAToggle.tsx
+++ b/src/view/screens/Settings/Email2FAToggle.tsx
@@ -13,17 +13,17 @@ export function Email2FAToggle() {
   const {currentAccount} = useSession()
   const {openModal} = useModalControls()
   const disableDialogCtrl = useDialogControl()
-  const {getAgent} = useAgent()
+  const agent = useAgent()
 
   const enableEmailAuthFactor = React.useCallback(async () => {
     if (currentAccount?.email) {
-      await getAgent().com.atproto.server.updateEmail({
+      await agent.com.atproto.server.updateEmail({
         email: currentAccount.email,
         emailAuthFactor: true,
       })
-      await getAgent().resumeSession(getAgent().session!)
+      await agent.resumeSession(agent.session!)
     }
-  }, [currentAccount, getAgent])
+  }, [currentAccount, agent])
 
   const onToggle = React.useCallback(() => {
     if (!currentAccount) {
diff --git a/src/view/screens/Settings/ExportCarDialog.tsx b/src/view/screens/Settings/ExportCarDialog.tsx
index af835cb62..72d943bcf 100644
--- a/src/view/screens/Settings/ExportCarDialog.tsx
+++ b/src/view/screens/Settings/ExportCarDialog.tsx
@@ -21,11 +21,10 @@ export function ExportCarDialog({
 }) {
   const {_} = useLingui()
   const t = useTheme()
-  const {getAgent} = useAgent()
+  const agent = useAgent()
   const [loading, setLoading] = React.useState(false)
 
   const download = React.useCallback(async () => {
-    const agent = getAgent()
     if (!agent.session) {
       return // shouldnt ever happen
     }
@@ -49,7 +48,7 @@ export function ExportCarDialog({
       setLoading(false)
       control.close()
     }
-  }, [_, control, getAgent])
+  }, [_, control, agent])
 
   return (
     <Dialog.Outer control={control}>