diff --git a/src/components/contacts/screens/ViewMatches.tsx b/src/components/contacts/screens/ViewMatches.tsx index 84aa082d84..8fc53d79d8 100644 --- a/src/components/contacts/screens/ViewMatches.tsx +++ b/src/components/contacts/screens/ViewMatches.tsx @@ -1,11 +1,10 @@ import {useMemo, useRef, useState} from 'react' import {View} from 'react-native' -import * as Contacts from 'expo-contacts' import * as SMS from 'expo-sms' import {type ModerationOpts} from '@atproto/api' import {msg, Plural, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' +import {useMutation, useQueryClient} from '@tanstack/react-query' import {wait} from '#/lib/async/wait' import {cleanError, isNetworkError} from '#/lib/strings/errors' @@ -294,7 +293,7 @@ export function ViewMatches({ case 'search empty state': return case 'totally empty state': - return + return } } @@ -542,64 +541,8 @@ function SearchEmptyState({query}: {query: string}) { ) } -function TotallyEmptyState({ - dispatch, -}: { - dispatch: React.ActionDispatch<[Action]> -}) { +function TotallyEmptyState() { const t = useTheme() - const {_} = useLingui() - - const {data} = useQuery({ - queryKey: ['contacts-permissions'], - queryFn: async () => await Contacts.getPermissionsAsync(), - }) - - const {mutate: uploadContacts, isPending: isUploadPending} = useMutation({ - mutationFn: async (_contacts: Contacts.ExistingContact[]) => { - await wait(2e3, () => {}) - }, - onSuccess: () => { - dispatch({ - type: 'SYNC_CONTACTS_SUCCESS', - payload: { - matches: [], - }, - }) - }, - }) - - const {mutate: addMore, isPending: isAddMorePending} = useMutation({ - mutationFn: async () => { - await Contacts.presentAccessPickerAsync() - - const contacts = await Contacts.getContactsAsync({ - fields: [ - Contacts.Fields.FirstName, - Contacts.Fields.LastName, - Contacts.Fields.PhoneNumbers, - Contacts.Fields.Image, - ], - }) - - return contacts.data - }, - onSuccess: contacts => { - dispatch({ - type: 'GET_CONTACTS_SUCCESS', - payload: {contacts}, - }) - uploadContacts(contacts) - }, - onError: err => { - logger.error('Add more contacts failed', {safeMessage: err}) - Toast.show(_(msg`Could not add more contacts. ${cleanError(err)}`)) - }, - }) - - const isPending = isAddMorePending || isUploadPending - - const isLimited = data?.accessPrivileges === 'limited' return ( - + No contacts found - {isLimited && ( - <> - - Would you like to try again? - - - - )} ) }