From c0d2a0c6f7305e43fe82c873a4f31c4c848b5cf7 Mon Sep 17 00:00:00 2001 From: KKA11010 Date: Thu, 3 Aug 2023 23:57:30 +0200 Subject: [PATCH] remove old contact context --- src/components/App.tsx | 88 ++++++++++++++++------------------------ src/context/Contacts.tsx | 28 ------------- src/model/index.ts | 7 ++++ src/storage/db/index.ts | 3 +- 4 files changed, 43 insertions(+), 83 deletions(-) delete mode 100644 src/context/Contacts.tsx diff --git a/src/components/App.tsx b/src/components/App.tsx index 8b2fc8f6..0521372d 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -3,7 +3,7 @@ import Button from '@comps/Button' import usePrompt from '@comps/hooks/Prompt' import { env } from '@consts' import { FiveMins } from '@consts/time' -import { addAllMintIds, getBalance, getContacts, getMintsBalances, getMintsUrls, getPreferences, initDb, setPreferences } from '@db' +import { addAllMintIds, getBalance, getMintsBalances, getMintsUrls, getPreferences, initDb, setPreferences } from '@db' import { fsInfo } from '@db/fs' import { l } from '@log' import MyModal from '@modal' @@ -11,7 +11,6 @@ import type { IPreferences, ITokenInfo } from '@model' import type { INavigatorProps } from '@model/nav' import Navigator from '@nav/Navigator' import { NavigationContainer, NavigationContainerRef } from '@react-navigation/native' -import { ContactsContext, type IContact } from '@src/context/Contacts' import { FocusClaimCtx } from '@src/context/FocusClaim' import { KeyboardProvider } from '@src/context/Keyboard' import { PinCtx } from '@src/context/Pin' @@ -125,12 +124,6 @@ function _App() { const [highlight, setHighlight] = useState('Default') // eslint-disable-next-line react-hooks/exhaustive-deps const themeData = useMemo(() => ({ pref, theme, setTheme, color, highlight, setHighlight }), [pref]) - // address book - const [contacts, setContacts] = useState([]) - const hasOwnAddress = () => contacts.some(c => c.isOwner) - const getPersonalInfo = () => contacts.find(c => c.isOwner) - // eslint-disable-next-line react-hooks/exhaustive-deps - const contactData = useMemo(() => ({ contacts, setContacts, hasOwnAddress, getPersonalInfo }), [contacts]) // app foregorund, background const appState = useRef(AppState.currentState) const [tokenInfo, setTokenInfo] = useState() @@ -267,14 +260,6 @@ function _App() { await SplashScreen.hideAsync() } } - async function initContacts() { - try { - const contactsDB = await getContacts() - setContacts(contactsDB) - } catch (e) { - l('Error while initializing contacts from DB') - } - } async function initAuth() { const data = await Promise.all([ secureStore.get('auth_pin'), @@ -295,7 +280,6 @@ function _App() { store.get(STORE_KEYS.lang), getMintsBalances(), getBalance(), - initContacts(), initPreferences(), initAuth(), ]) @@ -356,43 +340,41 @@ function _App() { > - - - - - {/* claim token if app comes to foreground and clipboard has valid cashu token */} - setClaimOpen(false)}> - - {t('foundCashuClipboard')} - - - {t('memo', { ns: 'history' })}: {tokenInfo?.decoded.memo}{'\n'} - - {' '}Satoshi {t('fromMint')}:{' '} - {tokenInfo?.mints.join(', ')} - -