From ba7c5783ea8f48eb622c0eb3f02a5e08afcb2fa4 Mon Sep 17 00:00:00 2001 From: "xan.lol" Date: Tue, 11 Aug 2026 23:56:49 -0700 Subject: [PATCH] app pwds ask for pwd on oauth, compact mode fix --- .../Settings/PrivacyAndSecuritySettings.tsx | 39 ++++++++++++++++--- src/state/queries/app-passwords.ts | 5 ++- src/view/com/posts/ViewFullThread.tsx | 8 ++-- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/screens/Settings/PrivacyAndSecuritySettings.tsx b/src/screens/Settings/PrivacyAndSecuritySettings.tsx index 2979ace21..e88629246 100644 --- a/src/screens/Settings/PrivacyAndSecuritySettings.tsx +++ b/src/screens/Settings/PrivacyAndSecuritySettings.tsx @@ -1,3 +1,4 @@ +import {useEffect, useState} from 'react' import {type AppBskyNotificationDeclaration} from '@atproto/api' import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' @@ -11,6 +12,8 @@ import {useSession} from '#/state/session' import * as SettingsList from '#/screens/Settings/components/SettingsList' import {atoms as a, useTheme} from '#/alf' import * as Admonition from '#/components/Admonition' +import * as Dialog from '#/components/Dialog' +import {LegacyAuthRequiredDialogContent} from '#/components/dialogs/LegacyAuthRequiredDialog' import {BellRinging_Stroke2_Corner0_Rounded as BellRingingIcon} from '#/components/icons/BellRinging' import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlashIcon} from '#/components/icons/EyeSlash' import {Key_Stroke2_Corner2_Rounded as KeyIcon} from '#/components/icons/Key' @@ -25,17 +28,36 @@ type Props = NativeStackScreenProps< CommonNavigatorParams, 'PrivacyAndSecuritySettings' > -export function PrivacyAndSecuritySettingsScreen({}: Props) { +export function PrivacyAndSecuritySettingsScreen({navigation}: Props) { const {_} = useLingui() const t = useTheme() - const {data: appPasswords} = useAppPasswordsQuery() const {currentAccount} = useSession() + const isOauth = !!currentAccount?.isOauthSession + const {data: appPasswords} = useAppPasswordsQuery({enabled: !isOauth}) + const legacyAuthControl = Dialog.useDialogControl() + const [awaitingPasswordAuth, setAwaitingPasswordAuth] = useState(false) const { data: notificationDeclaration, isPending, isError, } = useNotificationDeclarationQuery() + useEffect(() => { + if (awaitingPasswordAuth && !isOauth) { + setAwaitingPasswordAuth(false) + legacyAuthControl.close(() => navigation.navigate('AppPasswords')) + } + }, [awaitingPasswordAuth, isOauth, legacyAuthControl, navigation]) + + const onPressAppPasswords = () => { + if (isOauth) { + setAwaitingPasswordAuth(true) + legacyAuthControl.open() + } else { + navigation.navigate('AppPasswords') + } + } + return ( @@ -67,8 +89,8 @@ export function PrivacyAndSecuritySettingsScreen({}: Props) { - @@ -79,7 +101,8 @@ export function PrivacyAndSecuritySettingsScreen({}: Props) { {appPasswords.length} )} - + + + setAwaitingPasswordAuth(false)} + nativeOptions={{preventExpansion: true}}> + + ) } diff --git a/src/state/queries/app-passwords.ts b/src/state/queries/app-passwords.ts index ace23ab00..4bb34ee47 100644 --- a/src/state/queries/app-passwords.ts +++ b/src/state/queries/app-passwords.ts @@ -8,9 +8,12 @@ import {pdsAgent} from '../session/agent' const RQKEY_ROOT = 'app-passwords' export const RQKEY = () => [RQKEY_ROOT] -export function useAppPasswordsQuery() { +export function useAppPasswordsQuery({ + enabled = true, +}: {enabled?: boolean} = {}) { const agent = useAgent() return useQuery({ + enabled, staleTime: STALE.MINUTES.FIVE, queryKey: RQKEY(), queryFn: async () => { diff --git a/src/view/com/posts/ViewFullThread.tsx b/src/view/com/posts/ViewFullThread.tsx index f346a3439..24b616e19 100644 --- a/src/view/com/posts/ViewFullThread.tsx +++ b/src/view/com/posts/ViewFullThread.tsx @@ -5,6 +5,7 @@ import {AtUri} from '@atproto/api' import {useLingui} from '@lingui/react/macro' import {makeProfileLink} from '#/lib/routes/links' +import {useCompactPosts} from '#/state/preferences/compact-posts' import {atoms as a, select, useTheme} from '#/alf' import {Link} from '#/components/Link' import {SubtleHover} from '#/components/SubtleHover' @@ -12,6 +13,7 @@ import {Text} from '#/components/Typography' export function ViewFullThread({uri}: {uri: string}) { const t = useTheme() + const compactPosts = useCompactPosts() const itemHref = useMemo(() => { const urip = new AtUri(uri) return makeProfileLink({did: urip.hostname, handle: ''}, 'post', urip.rkey) @@ -23,8 +25,8 @@ export function ViewFullThread({uri}: {uri: string}) { style={[ a.flex_row, { - gap: 10, - paddingLeft: 18, + gap: compactPosts ? 8 : 10, + paddingLeft: compactPosts ? 16 : 18, }, ]} to={itemHref} @@ -36,7 +38,7 @@ export function ViewFullThread({uri}: {uri: string}) { // adjust position for visual alignment - the actual box has lots of top padding and not much bottom padding -sfn style={{top: 8, bottom: -5}} /> - +