check availablility in settings screen
This commit is contained in:
@@ -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'
|
import {type Action, type State} from '../state'
|
||||||
|
|
||||||
export function ViewMatches({}: {
|
export function ViewMatches({}: {
|
||||||
state: Extract<State, {step: '4: view matches'}>
|
state: Extract<State, {step: '4: view matches'}>
|
||||||
dispatch: React.Dispatch<Action>
|
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>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import * as Contacts from 'expo-contacts'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
import {useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type AllNavigatorParams,
|
type AllNavigatorParams,
|
||||||
@@ -20,6 +22,11 @@ export function SyncContactsSettingsScreen({}: Props) {
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
|
const {data: isAvailable} = useQuery({
|
||||||
|
queryKey: ['contacts-available'],
|
||||||
|
queryFn: async () => await Contacts.isAvailableAsync(),
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Screen>
|
<Layout.Screen>
|
||||||
<Layout.Header.Outer>
|
<Layout.Header.Outer>
|
||||||
@@ -59,18 +66,20 @@ export function SyncContactsSettingsScreen({}: Props) {
|
|||||||
</Trans>
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</SettingsList.Item>
|
</SettingsList.Item>
|
||||||
<SettingsList.Item>
|
{isAvailable && (
|
||||||
<Link
|
<SettingsList.Item>
|
||||||
to={{screen: 'SyncContactsFlow'}}
|
<Link
|
||||||
label={_(msg`Upload contacts`)}
|
to={{screen: 'SyncContactsFlow'}}
|
||||||
size="large"
|
label={_(msg`Upload contacts`)}
|
||||||
color="primary"
|
size="large"
|
||||||
style={[a.flex_1, a.justify_center]}>
|
color="primary"
|
||||||
<ButtonText>
|
style={[a.flex_1, a.justify_center]}>
|
||||||
<Trans>Upload contacts</Trans>
|
<ButtonText>
|
||||||
</ButtonText>
|
<Trans>Upload contacts</Trans>
|
||||||
</Link>
|
</ButtonText>
|
||||||
</SettingsList.Item>
|
</Link>
|
||||||
|
</SettingsList.Item>
|
||||||
|
)}
|
||||||
</SettingsList.Container>
|
</SettingsList.Container>
|
||||||
</Layout.Content>
|
</Layout.Content>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user