diff --git a/src/components/dialogs/ChangeEmailDialog.tsx b/src/components/dialogs/ChangeEmailDialog.tsx
deleted file mode 100644
index 93397bae93..0000000000
--- a/src/components/dialogs/ChangeEmailDialog.tsx
+++ /dev/null
@@ -1,259 +0,0 @@
-import {useState} from 'react'
-import {View} from 'react-native'
-import {msg, Trans} from '@lingui/macro'
-import {useLingui} from '@lingui/react'
-
-import {cleanError} from '#/lib/strings/errors'
-import {useAgent, useSession} from '#/state/session'
-import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
-import {atoms as a, useBreakpoints, web} from '#/alf'
-import {Button, ButtonText} from '#/components/Button'
-import * as Dialog from '#/components/Dialog'
-import * as TextField from '#/components/forms/TextField'
-import {Loader} from '#/components/Loader'
-import {Text} from '#/components/Typography'
-
-export function ChangeEmailDialog({
- control,
- verifyEmailControl,
-}: {
- control: Dialog.DialogControlProps
- verifyEmailControl: Dialog.DialogControlProps
-}) {
- return (
-
-
-
-
- )
-}
-
-export function Inner({
- verifyEmailControl,
-}: {
- verifyEmailControl: Dialog.DialogControlProps
-}) {
- const {_} = useLingui()
- const {currentAccount} = useSession()
- const agent = useAgent()
- const control = Dialog.useDialogContext()
- const {gtMobile} = useBreakpoints()
-
- const [currentStep, setCurrentStep] = useState<
- 'StepOne' | 'StepTwo' | 'StepThree'
- >('StepOne')
- const [email, setEmail] = useState('')
- const [confirmationCode, setConfirmationCode] = useState('')
- const [isProcessing, setIsProcessing] = useState(false)
- const [error, setError] = useState('')
-
- const currentEmail = currentAccount?.email || '(no email)'
- const uiStrings = {
- StepOne: {
- title: _(msg`Change Your Email`),
- message: '',
- },
- StepTwo: {
- title: _(msg`Security Step Required`),
- message: _(
- msg`An email has been sent to your previous address, ${currentEmail}. It includes a confirmation code which you can enter below.`,
- ),
- },
- StepThree: {
- title: _(msg`Email Updated!`),
- message: _(
- msg`Your email address has been updated but it is not yet verified. As a next step, please verify your new email.`,
- ),
- },
- }
-
- const onRequestChange = async () => {
- if (email === currentAccount?.email) {
- setError(
- _(
- msg`The email address you entered is the same as your current email address.`,
- ),
- )
- return
- }
- setError('')
- setIsProcessing(true)
- try {
- const res = await agent.com.atproto.server.requestEmailUpdate()
- if (res.data.tokenRequired) {
- setCurrentStep('StepTwo')
- } else {
- await agent.com.atproto.server.updateEmail({email: email.trim()})
- await agent.resumeSession(agent.session!)
- setCurrentStep('StepThree')
- }
- } catch (e) {
- setError(cleanError(String(e)))
- } finally {
- setIsProcessing(false)
- }
- }
-
- const onConfirm = async () => {
- setError('')
- setIsProcessing(true)
- try {
- await agent.com.atproto.server.updateEmail({
- email: email.trim(),
- token: confirmationCode.trim(),
- })
- await agent.resumeSession(agent.session!)
- setCurrentStep('StepThree')
- } catch (e) {
- setError(cleanError(String(e)))
- } finally {
- setIsProcessing(false)
- }
- }
-
- const onVerify = async () => {
- control.close(() => {
- verifyEmailControl.open()
- })
- }
-
- return (
-
-
-
-
-
- {uiStrings[currentStep].title}
-
- {error ? (
-
-
-
- ) : null}
- {currentStep === 'StepOne' ? (
-
-
- Enter your new email address below.
-
-
-
-
-
- ) : (
-
- {uiStrings[currentStep].message}
-
- )}
-
- {currentStep === 'StepTwo' ? (
-
-
- Confirmation code
-
-
-
-
-
- ) : null}
-
- {currentStep === 'StepOne' ? (
- <>
-
-
- >
- ) : currentStep === 'StepTwo' ? (
- <>
-
-
- >
- ) : currentStep === 'StepThree' ? (
- <>
-
-
- >
- ) : null}
-
-
-
- )
-}
diff --git a/src/components/dialogs/VerifyEmailDialog.tsx b/src/components/dialogs/VerifyEmailDialog.tsx
deleted file mode 100644
index b8d1cd1925..0000000000
--- a/src/components/dialogs/VerifyEmailDialog.tsx
+++ /dev/null
@@ -1,360 +0,0 @@
-import {useState} from 'react'
-import {View} from 'react-native'
-import {msg, Trans} from '@lingui/macro'
-import {useLingui} from '@lingui/react'
-
-import {cleanError} from '#/lib/strings/errors'
-import {logger} from '#/logger'
-import {useAgent, useSession} from '#/state/session'
-import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
-import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
-import {Button, ButtonText} from '#/components/Button'
-import * as Dialog from '#/components/Dialog'
-import * as TextField from '#/components/forms/TextField'
-import {Envelope_Filled_Stroke2_Corner0_Rounded as EnvelopeIcon} from '#/components/icons/Envelope'
-import {InlineLinkText} from '#/components/Link'
-import {Loader} from '#/components/Loader'
-import {Text} from '#/components/Typography'
-import {ChangeEmailDialog} from './ChangeEmailDialog'
-
-export function VerifyEmailDialog({
- control,
- onCloseWithoutVerifying,
- onCloseAfterVerifying,
- reasonText,
- changeEmailControl,
- reminder,
-}: {
- control: Dialog.DialogControlProps
- onCloseWithoutVerifying?: () => void
- onCloseAfterVerifying?: () => void
- reasonText?: string
- /**
- * if a changeEmailControl for a ChangeEmailDialog is not provided,
- * this component will create one for you. Using this prop
- * helps reduce duplication, since these dialogs are often used together.
- */
- changeEmailControl?: Dialog.DialogControlProps
- reminder?: boolean
-}) {
- const agent = useAgent()
- const fallbackChangeEmailControl = Dialog.useDialogControl()
-
- const [didVerify, setDidVerify] = useState(false)
-
- return (
- <>
- {
- if (!didVerify) {
- onCloseWithoutVerifying?.()
- return
- }
-
- try {
- await agent.resumeSession(agent.session!)
- onCloseAfterVerifying?.()
- } catch (e: unknown) {
- logger.error(String(e))
- return
- }
- }}>
-
-
-
- {!changeEmailControl && (
-
- )}
- >
- )
-}
-
-export function Inner({
- setDidVerify,
- reasonText,
- changeEmailControl,
- reminder,
-}: {
- setDidVerify: (value: boolean) => void
- reasonText?: string
- changeEmailControl: Dialog.DialogControlProps
- reminder?: boolean
-}) {
- const control = Dialog.useDialogContext()
- const {_} = useLingui()
- const {currentAccount} = useSession()
- const agent = useAgent()
- const {gtMobile} = useBreakpoints()
- const t = useTheme()
-
- const [currentStep, setCurrentStep] = useState<
- 'Reminder' | 'StepOne' | 'StepTwo' | 'StepThree'
- >(reminder ? 'Reminder' : 'StepOne')
- const [confirmationCode, setConfirmationCode] = useState('')
- const [isProcessing, setIsProcessing] = useState(false)
- const [error, setError] = useState('')
-
- const uiStrings = {
- Reminder: {
- title: _(msg`Please Verify Your Email`),
- message: _(
- msg`Your email has not yet been verified. This is an important security step which we recommend.`,
- ),
- },
- StepOne: {
- title: _(msg`Verify Your Email`),
- message: '',
- },
- StepTwo: {
- title: _(msg`Enter Code`),
- message: _(
- msg`An email has been sent! Please enter the confirmation code included in the email below.`,
- ),
- },
- StepThree: {
- title: _(msg`Success!`),
- message: _(msg`Thank you! Your email has been successfully verified.`),
- },
- }
-
- const onSendEmail = async () => {
- setError('')
- setIsProcessing(true)
- try {
- await agent.com.atproto.server.requestEmailConfirmation()
- setCurrentStep('StepTwo')
- } catch (e: unknown) {
- setError(cleanError(e))
- } finally {
- setIsProcessing(false)
- }
- }
-
- const onVerifyEmail = async () => {
- setError('')
- setIsProcessing(true)
- try {
- await agent.com.atproto.server.confirmEmail({
- email: (currentAccount?.email || '').trim(),
- token: confirmationCode.trim(),
- })
- } catch (e: unknown) {
- setError(cleanError(String(e)))
- setIsProcessing(false)
- return
- }
-
- setIsProcessing(false)
- setDidVerify(true)
- setCurrentStep('StepThree')
- }
-
- return (
-
-
- {currentStep === 'Reminder' && (
-
-
-
- )}
-
-
- {uiStrings[currentStep].title}
-
- {error ? (
-
-
-
- ) : null}
- {currentStep === 'StepOne' ? (
-
- {reasonText ? (
-
- {reasonText}
-
- Don't have access to{' '}
-
- {currentAccount?.email}
-
- ?{' '}
- {
- e.preventDefault()
- control.close(() => {
- changeEmailControl.open()
- })
- return false
- }}>
- Change your email address
-
- .
-
-
- ) : (
-
-
- You'll receive an email at{' '}
-
- {currentAccount?.email}
- {' '}
- to verify it's you.
- {' '}
- {
- e.preventDefault()
- control.close(() => {
- changeEmailControl.open()
- })
- return false
- }}>
- Need to change it?
-
-
- )}
-
- ) : (
-
- {uiStrings[currentStep].message}
-
- )}
-
- {currentStep === 'StepTwo' ? (
-
-
- Confirmation Code
-
-
-
-
-
- ) : null}
-
- {currentStep === 'Reminder' ? (
- <>
-
-
- >
- ) : currentStep === 'StepOne' ? (
- <>
-
-
- >
- ) : currentStep === 'StepTwo' ? (
- <>
-
-
- >
- ) : currentStep === 'StepThree' ? (
-
- ) : null}
-
-
-
- )
-}