check availablility in settings screen

This commit is contained in:
Samuel Newman
2025-11-28 18:56:08 +02:00
parent bf7fef1c4c
commit feddd552e7
2 changed files with 34 additions and 13 deletions
@@ -1,8 +1,20 @@
import {View} from 'react-native'
import {atoms as a} from '#/alf'
import * as Layout from '#/components/Layout'
import {type Action, type State} from '../state'
export function ViewMatches({}: {
state: Extract<State, {step: '4: view matches'}>
dispatch: React.Dispatch<Action>
}) {
return null
return (
<View style={[a.h_full]}>
<Layout.Header.Outer noBottomBorder>
<Layout.Header.BackButton />
<Layout.Header.Content />
<Layout.Header.Slot />
</Layout.Header.Outer>
</View>
)
}
+21 -12
View File
@@ -1,5 +1,7 @@
import * as Contacts from 'expo-contacts'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useQuery} from '@tanstack/react-query'
import {
type AllNavigatorParams,
@@ -20,6 +22,11 @@ export function SyncContactsSettingsScreen({}: Props) {
const t = useTheme()
const {_} = useLingui()
const {data: isAvailable} = useQuery({
queryKey: ['contacts-available'],
queryFn: async () => await Contacts.isAvailableAsync(),
})
return (
<Layout.Screen>
<Layout.Header.Outer>
@@ -59,18 +66,20 @@ export function SyncContactsSettingsScreen({}: Props) {
</Trans>
</Text>
</SettingsList.Item>
<SettingsList.Item>
<Link
to={{screen: 'SyncContactsFlow'}}
label={_(msg`Upload contacts`)}
size="large"
color="primary"
style={[a.flex_1, a.justify_center]}>
<ButtonText>
<Trans>Upload contacts</Trans>
</ButtonText>
</Link>
</SettingsList.Item>
{isAvailable && (
<SettingsList.Item>
<Link
to={{screen: 'SyncContactsFlow'}}
label={_(msg`Upload contacts`)}
size="large"
color="primary"
style={[a.flex_1, a.justify_center]}>
<ButtonText>
<Trans>Upload contacts</Trans>
</ButtonText>
</Link>
</SettingsList.Item>
)}
</SettingsList.Container>
</Layout.Content>
) : (