Merge branch 'bluesky-social:main' into patch-3

This commit is contained in:
Minseo Lee 2024-03-16 16:23:04 +09:00 committed by GitHub
commit 6d57094c6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 337 additions and 171 deletions

View file

@ -40,7 +40,10 @@ import {
} from '#/state/preferences'
import {useSession, useSessionApi, SessionAccount} from '#/state/session'
import {useProfileQuery} from '#/state/queries/profile'
import {useClearPreferencesMutation} from '#/state/queries/preferences'
import {
useClearPreferencesMutation,
usePreferencesQuery,
} from '#/state/queries/preferences'
// TODO import {useInviteCodesQuery} from '#/state/queries/invites'
import {clear as clearStorage} from '#/state/persisted/store'
import {clearLegacyStorage} from '#/state/persisted/legacy'
@ -68,6 +71,7 @@ import {SelectableBtn} from 'view/com/util/forms/SelectableBtn'
import {AccountDropdownBtn} from 'view/com/util/AccountDropdownBtn'
import {SimpleViewHeader} from 'view/com/util/SimpleViewHeader'
import {ExportCarDialog} from './ExportCarDialog'
import {BirthDateSettingsDialog} from '#/components/dialogs/BirthDateSettings'
function SettingsAccountCard({account}: {account: SessionAccount}) {
const pal = usePalette('default')
@ -152,6 +156,7 @@ export function SettingsScreen({}: Props) {
const {screen, track} = useAnalytics()
const {openModal} = useModalControls()
const {isSwitchingAccounts, accounts, currentAccount} = useSession()
const {data: preferences} = usePreferencesQuery()
const {mutate: clearPreferences} = useClearPreferencesMutation()
// TODO
// const {data: invites} = useInviteCodesQuery()
@ -159,6 +164,7 @@ export function SettingsScreen({}: Props) {
const {setShowLoggedOut} = useLoggedOutViewControls()
const closeAllActiveElements = useCloseAllActiveElements()
const exportCarControl = useDialogControl()
const birthdayControl = useDialogControl()
// const primaryBg = useCustomPalette<ViewStyle>({
// light: {backgroundColor: colors.blue0},
@ -269,6 +275,10 @@ export function SettingsScreen({}: Props) {
Linking.openURL(STATUS_PAGE_URL)
}, [])
const onPressBirthday = React.useCallback(() => {
birthdayControl.open()
}, [birthdayControl])
const clearAllStorage = React.useCallback(async () => {
await clearStorage()
Toast.show(_(msg`Storage cleared, you need to restart the app now.`))
@ -281,6 +291,10 @@ export function SettingsScreen({}: Props) {
return (
<View style={s.hContentRegion} testID="settingsScreen">
<ExportCarDialog control={exportCarControl} />
<BirthDateSettingsDialog
control={birthdayControl}
preferences={preferences}
/>
<SimpleViewHeader
showBackButton={isMobile}
@ -339,7 +353,7 @@ export function SettingsScreen({}: Props) {
<Text type="lg-medium" style={pal.text}>
<Trans>Birthday:</Trans>{' '}
</Text>
<Link onPress={() => openModal({name: 'birth-date-settings'})}>
<Link onPress={onPressBirthday}>
<Text type="lg" style={pal.link}>
<Trans>Show</Trans>
</Text>