1+ import Clipboard from '@react-native-clipboard/clipboard' ;
2+ import { parse } from '@synonymdev/slashtags-url' ;
13import React , { ReactElement , useCallback , useMemo , useState } from 'react' ;
4+ import { useTranslation } from 'react-i18next' ;
25import { ActivityIndicator , StyleSheet } from 'react-native' ;
3- import { useAppDispatch , useAppSelector } from '../../hooks/redux' ;
46import { FadeIn , FadeOut } from 'react-native-reanimated' ;
5- import Clipboard from '@react-native-clipboard/clipboard' ;
67import Share from 'react-native-share' ;
7- import { useTranslation } from 'react-i18next' ;
8- import { parse } from '@synonymdev/slashtags-url' ;
98
9+ import Dialog from '../../components/Dialog' ;
10+ import NavigationHeader from '../../components/NavigationHeader' ;
11+ import ProfileCard from '../../components/ProfileCard' ;
12+ import ProfileLinks from '../../components/ProfileLinks' ;
13+ import SafeAreaInset from '../../components/SafeAreaInset' ;
14+ import Tooltip from '../../components/Tooltip' ;
15+ import IconButton from '../../components/buttons/IconButton' ;
16+ import { useAppDispatch , useAppSelector } from '../../hooks/redux' ;
17+ import { useProfile } from '../../hooks/slashtags' ;
18+ import { useBalance } from '../../hooks/wallet' ;
19+ import { RootStackScreenProps } from '../../navigation/types' ;
20+ import { contactsSelector } from '../../store/reselect/slashtags' ;
21+ import { isLDKReadySelector } from '../../store/reselect/ui' ;
22+ import { selectedNetworkSelector } from '../../store/reselect/wallet' ;
23+ import { deleteContact } from '../../store/slices/slashtags' ;
1024import { AnimatedView , View } from '../../styles/components' ;
1125import {
1226 CoinsIcon ,
@@ -15,22 +29,9 @@ import {
1529 ShareIcon ,
1630 TrashIcon ,
1731} from '../../styles/icons' ;
18- import NavigationHeader from '../../components/NavigationHeader' ;
19- import SafeAreaInset from '../../components/SafeAreaInset' ;
20- import ProfileCard from '../../components/ProfileCard' ;
21- import ProfileLinks from '../../components/ProfileLinks' ;
22- import { processUri } from '../../utils/scanner/scanner' ;
23- import { useProfile } from '../../hooks/slashtags' ;
24- import { useBalance } from '../../hooks/wallet' ;
2532import { truncate } from '../../utils/helpers' ;
2633import { showToast } from '../../utils/notifications' ;
27- import { RootStackScreenProps } from '../../navigation/types' ;
28- import Dialog from '../../components/Dialog' ;
29- import Tooltip from '../../components/Tooltip' ;
30- import IconButton from '../../components/buttons/IconButton' ;
31- import { deleteContact } from '../../store/slices/slashtags' ;
32- import { selectedNetworkSelector } from '../../store/reselect/wallet' ;
33- import { contactsSelector } from '../../store/reselect/slashtags' ;
34+ import { processUri } from '../../utils/scanner/scanner' ;
3435
3536const Contact = ( {
3637 navigation,
@@ -46,6 +47,7 @@ const Contact = ({
4647 const dispatch = useAppDispatch ( ) ;
4748 const selectedNetwork = useAppSelector ( selectedNetworkSelector ) ;
4849 const contacts = useAppSelector ( contactsSelector ) ;
50+ const isLDKReady = useAppSelector ( isLDKReadySelector ) ;
4951
5052 const { profile } = useProfile ( url ) ;
5153 const savedContact = useMemo ( ( ) => {
@@ -75,7 +77,20 @@ const Contact = ({
7577 } , [ navigation , url , dispatch ] ) ;
7678
7779 const handleSend = async ( ) : Promise < void > => {
80+ if ( loading ) {
81+ return ;
82+ }
7883 setLoading ( true ) ;
84+
85+ // if LDK is not ready yet, show a toast warning that it might take a few seconds
86+ if ( ! isLDKReady ) {
87+ showToast ( {
88+ type : 'info' ,
89+ title : t ( 'contact_ldk_not_ready' ) ,
90+ description : t ( 'lightning:wait_text_top' ) ,
91+ } ) ;
92+ }
93+
7994 const res = await processUri ( {
8095 uri : url ,
8196 source : 'send' ,
0 commit comments