File tree Expand file tree Collapse file tree 3 files changed +55
-5
lines changed Expand file tree Collapse file tree 3 files changed +55
-5
lines changed Original file line number Diff line number Diff line change 397397          }
398398        }
399399      }
400+     },
401+     "Get sats from faucet" : {
402+ 
400403    },
401404    "HomeView Error" : {
402405      "localizations" : {
Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ import Foundation
1212@Observable  
1313class  TransactionListViewModel  { 
1414    let  bdkClient :  BDKClient 
15+     let  keyClient :  KeyClient 
1516
1617    var  showingWalletTransactionsViewErrorAlert   =  false 
1718    var  walletTransactionsViewError :  AppError ? 
1819
1920    init ( 
20-         bdkClient:  BDKClient  =  . live
21+         bdkClient:  BDKClient  =  . live, 
22+         keyClient:  KeyClient  =  . live
2123    )  { 
2224        self . bdkClient =  bdkClient
25+         self . keyClient =  keyClient
2326    } 
2427
2528    func  getSentAndReceived( tx:  BitcoinDevKit . Transaction )  ->  SentAndReceivedValues ?   { 
@@ -35,4 +38,9 @@ class TransactionListViewModel {
3538        } 
3639    } 
3740
41+     func  getEsploraURL( )  ->  String ?   { 
42+         let  savedEsploraURL  =  try ?   keyClient. getEsploraURL ( ) 
43+         return  savedEsploraURL
44+     } 
45+ 
3846} 
Original file line number Diff line number Diff line change @@ -29,10 +29,40 @@ struct TransactionListView: View {
2929                . listRowInsets ( EdgeInsets ( ) ) 
3030                . listRowSeparator ( . hidden) 
3131            }  else  if  transactions. isEmpty { 
32-                 Text ( " No Transactions " ) 
33-                     . font ( . subheadline) 
34-                     . listRowInsets ( EdgeInsets ( ) ) 
35-                     . listRowSeparator ( . hidden) 
32+ 
33+                 VStack ( alignment:  . leading)  { 
34+ 
35+                     Text ( " No Transactions " ) 
36+                         . font ( . subheadline) 
37+ 
38+                     let  mutinyFaucetURL  =  URL ( string:  " https://faucet.mutinynet.com " ) 
39+                     let  signetFaucetURL  =  URL ( string:  " https://signetfaucet.com " ) 
40+ 
41+                     if  let  mutinyFaucetURL,  let  signetFaucetURL { 
42+ 
43+                         Button  { 
44+                             UIApplication . shared. open ( 
45+                                 viewModel. getEsploraURL ( ) 
46+                                     ==  Constants . Config. EsploraServerURLNetwork. Signet. mutiny
47+                                     ?  mutinyFaucetURL :  signetFaucetURL
48+                             ) 
49+                         }  label:  { 
50+                             HStack ( spacing:  2 )  { 
51+                                 Text ( " Get sats from faucet " ) 
52+                                 Image ( systemName:  " arrow.right " ) 
53+                             } 
54+                             . font ( . caption) 
55+                             . foregroundStyle ( . secondary) 
56+                             . underline ( ) 
57+                         } 
58+                         . buttonStyle ( . plain) 
59+ 
60+                     } 
61+ 
62+                 } 
63+                 . listRowInsets ( EdgeInsets ( ) ) 
64+                 . listRowSeparator ( . hidden) 
65+ 
3666            }  else  { 
3767
3868                ForEach ( 
@@ -99,4 +129,13 @@ struct TransactionListView: View {
99129            walletSyncState:  . synced
100130        ) 
101131    } 
132+     #Preview { 
133+         TransactionListView ( 
134+             viewModel:  . init( 
135+                 bdkClient:  . mock
136+             ) , 
137+             transactions:  [ ] , 
138+             walletSyncState:  . synced
139+         ) 
140+     } 
102141#endif 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments