Fix crash when deleting account from NoAccessScreen (#10283)
This commit is contained in:
@@ -141,18 +141,18 @@ export function useLink({
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (isExternal) {
|
if (isExternal) {
|
||||||
openLink(href, overridePresentation, shouldProxy)
|
void openLink(href, overridePresentation, shouldProxy)
|
||||||
} else {
|
} else {
|
||||||
const shouldOpenInNewTab = shouldClickOpenNewTab(e)
|
const shouldOpenInNewTab = shouldClickOpenNewTab(e)
|
||||||
|
|
||||||
if (isBskyDownloadUrl(href)) {
|
if (isBskyDownloadUrl(href)) {
|
||||||
shareUrl(BSKY_DOWNLOAD_URL)
|
void shareUrl(BSKY_DOWNLOAD_URL)
|
||||||
} else if (
|
} else if (
|
||||||
shouldOpenInNewTab ||
|
shouldOpenInNewTab ||
|
||||||
href.startsWith('http') ||
|
href.startsWith('http') ||
|
||||||
href.startsWith('mailto')
|
href.startsWith('mailto')
|
||||||
) {
|
) {
|
||||||
openLink(href)
|
void openLink(href)
|
||||||
} else {
|
} else {
|
||||||
closeModal() // close any active modals
|
closeModal() // close any active modals
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ export function useLink({
|
|||||||
share: true,
|
share: true,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
shareUrl(href)
|
void shareUrl(href)
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
disableMismatchWarning,
|
disableMismatchWarning,
|
||||||
@@ -451,7 +451,7 @@ export function SimpleInlineLinkText({
|
|||||||
const onPress = (e: GestureResponderEvent) => {
|
const onPress = (e: GestureResponderEvent) => {
|
||||||
const exitEarlyIfFalse = outerOnPress?.(e)
|
const exitEarlyIfFalse = outerOnPress?.(e)
|
||||||
if (exitEarlyIfFalse === false) return
|
if (exitEarlyIfFalse === false) return
|
||||||
Linking.openURL(href)
|
void Linking.openURL(href)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {useCleanError} from '#/lib/hooks/useCleanError'
|
|||||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useAgent, useSession, useSessionApi} from '#/state/session'
|
import {useAgent, useSession, useSessionApi} from '#/state/session'
|
||||||
import {atoms as a, useTheme, web} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Admonition} from '#/components/Admonition'
|
import {Admonition} from '#/components/Admonition'
|
||||||
import {type DialogOuterProps} from '#/components/Dialog'
|
import {type DialogOuterProps} from '#/components/Dialog'
|
||||||
import {
|
import {
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
import * as TextField from '#/components/forms/TextField'
|
import * as TextField from '#/components/forms/TextField'
|
||||||
import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope'
|
import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope'
|
||||||
import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock'
|
import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock'
|
||||||
import {createStaticClick, InlineLinkText} from '#/components/Link'
|
import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
|
||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
import * as toast from '#/components/Toast'
|
import * as toast from '#/components/Toast'
|
||||||
@@ -113,12 +113,9 @@ function DeleteAccountDialogInner({
|
|||||||
}
|
}
|
||||||
const token = confirmCode.replace(WHITESPACE_RE, '')
|
const token = confirmCode.replace(WHITESPACE_RE, '')
|
||||||
// Inform chat service of intent to delete account.
|
// Inform chat service of intent to delete account.
|
||||||
const {success} = await agent.api.chat.bsky.actor.deleteAccount(
|
const {success} = await agent.chat.bsky.actor.deleteAccount(undefined, {
|
||||||
undefined,
|
headers: DM_SERVICE_HEADERS,
|
||||||
{
|
})
|
||||||
headers: DM_SERVICE_HEADERS,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw new Error('Failed to inform chat service of account deletion')
|
throw new Error('Failed to inform chat service of account deletion')
|
||||||
}
|
}
|
||||||
@@ -213,11 +210,11 @@ function DeleteAccountDialogInner({
|
|||||||
<Admonition style={[a.mt_lg]} type="tip">
|
<Admonition style={[a.mt_lg]} type="tip">
|
||||||
<Trans>
|
<Trans>
|
||||||
You can also{' '}
|
You can also{' '}
|
||||||
<Span
|
<SimpleInlineLinkText
|
||||||
style={[{color: t.palette.primary_500}, web(a.underline)]}
|
label={_(msg`Temporarily deactivate your account`)}
|
||||||
onPress={handleDeactivate}>
|
{...createStaticClick(handleDeactivate)}>
|
||||||
temporarily deactivate
|
temporarily deactivate
|
||||||
</Span>{' '}
|
</SimpleInlineLinkText>{' '}
|
||||||
your account instead. Your profile, posts, feeds, and lists will
|
your account instead. Your profile, posts, feeds, and lists will
|
||||||
no longer be visible to other Bluesky users. You can reactivate
|
no longer be visible to other Bluesky users. You can reactivate
|
||||||
your account at any time by logging in.
|
your account at any time by logging in.
|
||||||
@@ -262,24 +259,20 @@ function DeleteAccountDialogInner({
|
|||||||
{emailSentCount > 1 ? (
|
{emailSentCount > 1 ? (
|
||||||
<Trans>
|
<Trans>
|
||||||
Email sent!{' '}
|
Email sent!{' '}
|
||||||
<InlineLinkText
|
<SimpleInlineLinkText
|
||||||
label={_(msg`Resend`)}
|
label={_(msg`Click here to resend the email`)}
|
||||||
{...createStaticClick(() => {
|
{...createStaticClick(handleSendEmail)}>
|
||||||
void handleSendEmail()
|
|
||||||
})}>
|
|
||||||
Click here to resend.
|
Click here to resend.
|
||||||
</InlineLinkText>
|
</SimpleInlineLinkText>
|
||||||
</Trans>
|
</Trans>
|
||||||
) : (
|
) : (
|
||||||
<Trans>
|
<Trans>
|
||||||
Don’t see a code?{' '}
|
Don’t see a code?{' '}
|
||||||
<InlineLinkText
|
<SimpleInlineLinkText
|
||||||
label={_(msg`Resend`)}
|
label={_(msg`Click here to resend the email`)}
|
||||||
{...createStaticClick(() => {
|
{...createStaticClick(handleSendEmail)}>
|
||||||
void handleSendEmail()
|
|
||||||
})}>
|
|
||||||
Click here to resend.
|
Click here to resend.
|
||||||
</InlineLinkText>
|
</SimpleInlineLinkText>
|
||||||
</Trans>
|
</Trans>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
<Span style={{top: 1}}>
|
<Span style={{top: 1}}>
|
||||||
@@ -340,12 +333,11 @@ function DeleteAccountDialogInner({
|
|||||||
{currentHandle}
|
{currentHandle}
|
||||||
</Span>{' '}
|
</Span>{' '}
|
||||||
and all associated data. Note that this will affect any other{' '}
|
and all associated data. Note that this will affect any other{' '}
|
||||||
<InlineLinkText
|
<SimpleInlineLinkText
|
||||||
label={_(msg`Learn more about the AT Protocol.`)}
|
to="https://bsky.social/about/faq"
|
||||||
style={[a.text_md]}
|
label={_(msg`AT Protocol FAQ`)}>
|
||||||
to="https://bsky.social/about/faq">
|
|
||||||
AT Protocol
|
AT Protocol
|
||||||
</InlineLinkText>{' '}
|
</SimpleInlineLinkText>{' '}
|
||||||
services you use with this account.
|
services you use with this account.
|
||||||
</Trans>
|
</Trans>
|
||||||
</Prompt.DescriptionText>
|
</Prompt.DescriptionText>
|
||||||
|
|||||||
Reference in New Issue
Block a user