rvv041 #82

Merged
pitmutt merged 30 commits from rvv041 into milestone2 2024-06-07 20:03:06 +00:00
Showing only changes of commit d57ac5db14 - Show all commits

View file

@ -192,10 +192,10 @@ data State = State
, _eventDispatch :: !(BC.BChan Tick) , _eventDispatch :: !(BC.BChan Tick)
, _timer :: !Int , _timer :: !Int
, _txForm :: !(Form SendInput () Name) , _txForm :: !(Form SendInput () Name)
, _abaddresses :: !(L.List Name (Entity AddressBook)) , _abAddresses :: !(L.List Name (Entity AddressBook))
pitmutt marked this conversation as resolved Outdated

The field should be named _abAddresses

The field should be named `_abAddresses`
, _abForm :: !(Form AdrBookEntry () Name) , _abForm :: !(Form AdrBookEntry () Name)
, _abCurAdrs :: !T.Text , _abCurAdrs :: !T.Text -- used for address book CRUD operations
pitmutt marked this conversation as resolved Outdated

What is this field for?

What is this field for?
, _abTxt :: !T.Text , _abTxt :: !T.Text -- Holds the Address Book entry data to show
pitmutt marked this conversation as resolved Outdated

What is this field for?

What is this field for?
} }
makeLenses ''State makeLenses ''State
@ -379,7 +379,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
hLimit 50 $ hLimit 50 $
vBox [vLimit 16 $ vBox [vLimit 16 $
hLimit 50 $ hLimit 50 $
vBox $ [ L.renderList listDrawAB True (s ^. abaddresses) ], vBox $ [ L.renderList listDrawAB True (s ^. abAddresses) ],
padTop Max $ padTop Max $
vLimit 4 $ vLimit 4 $
hLimit 50 $ hLimit 50 $
@ -1046,7 +1046,7 @@ appEvent (BT.VtyEvent e) = do
BT.modify $ set dialogBox Blank BT.modify $ set dialogBox Blank
V.EvKey (V.KChar 'c') [] -> do V.EvKey (V.KChar 'c') [] -> do
-- Copy Address to Clipboard -- Copy Address to Clipboard
case L.listSelectedElement $ s ^. abaddresses of case L.listSelectedElement $ s ^. abAddresses of
Just (_, a) -> do Just (_, a) -> do
liftIO $ liftIO $
setClipboard $ setClipboard $
@ -1062,7 +1062,7 @@ appEvent (BT.VtyEvent e) = do
BT.modify $ set displayBox MsgDisplay BT.modify $ set displayBox MsgDisplay
-- Send Zcash transaction -- Send Zcash transaction
V.EvKey (V.KChar 's') [] -> do V.EvKey (V.KChar 's') [] -> do
pitmutt marked this conversation as resolved Outdated

It is not necessary to show the address, it is too long for the message window. We should only use the name in the message.

It is not necessary to show the address, it is too long for the message window. We should only use the name in the message.
case L.listSelectedElement $ s ^. abaddresses of case L.listSelectedElement $ s ^. abAddresses of
Just (_, a) -> do Just (_, a) -> do
BT.modify $ BT.modify $
set txForm $ set txForm $
@ -1073,7 +1073,7 @@ appEvent (BT.VtyEvent e) = do
BT.modify $ set displayBox MsgDisplay BT.modify $ set displayBox MsgDisplay
-- Edit an entry in Address Book -- Edit an entry in Address Book
V.EvKey (V.KChar 'e') [] -> do V.EvKey (V.KChar 'e') [] -> do
case L.listSelectedElement $ s ^. abaddresses of case L.listSelectedElement $ s ^. abAddresses of
Just (_, a) -> do Just (_, a) -> do
BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a)) BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a))
BT.modify $ BT.modify $
@ -1084,7 +1084,7 @@ appEvent (BT.VtyEvent e) = do
BT.modify $ set dialogBox Blank BT.modify $ set dialogBox Blank
-- Delete an entry from Address Book -- Delete an entry from Address Book
V.EvKey (V.KChar 'd') [] -> do V.EvKey (V.KChar 'd') [] -> do
case L.listSelectedElement $ s ^. abaddresses of case L.listSelectedElement $ s ^. abAddresses of
Just (_, a) -> do Just (_, a) -> do
BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a)) BT.modify $ set abCurAdrs (addressBookAbaddress (entityVal a))
BT.modify $ BT.modify $
@ -1099,7 +1099,7 @@ appEvent (BT.VtyEvent e) = do
BT.modify $ set dialogBox AdrBookForm BT.modify $ set dialogBox AdrBookForm
-- Show AddressBook entry data -- Show AddressBook entry data
V.EvKey V.KEnter [] -> do V.EvKey V.KEnter [] -> do
case L.listSelectedElement $ s ^. abaddresses of case L.listSelectedElement $ s ^. abAddresses of
Just (_, a) -> do Just (_, a) -> do
BT.modify $ set abTxt $ T.pack $ BT.modify $ set abTxt $ T.pack $
" Descr: " ++ " Descr: " ++
@ -1110,7 +1110,7 @@ appEvent (BT.VtyEvent e) = do
_ -> do _ -> do
BT.modify $ set dialogBox Blank BT.modify $ set dialogBox Blank
-- Process any other event -- Process any other event
ev -> BT.zoom abaddresses $ L.handleListEvent ev ev -> BT.zoom abAddresses $ L.handleListEvent ev
-- Process new address book entry -- Process new address book entry
AdrBookForm -> do AdrBookForm -> do
case e of case e of
@ -1218,7 +1218,7 @@ appEvent (BT.VtyEvent e) = do
Just TList -> Just TList ->
BT.zoom transactions $ L.handleListEvent ev BT.zoom transactions $ L.handleListEvent ev
Just ABList -> Just ABList ->
BT.zoom abaddresses $ L.handleListEvent ev BT.zoom abAddresses $ L.handleListEvent ev
_anyName -> return () _anyName -> return ()
where where
printMsg :: String -> BT.EventM Name State () printMsg :: String -> BT.EventM Name State ()
@ -1485,18 +1485,18 @@ refreshAddressBook :: State -> IO State
refreshAddressBook s = do refreshAddressBook s = do
pool <- runNoLoggingT $ initPool $ s ^. dbPath pool <- runNoLoggingT $ initPool $ s ^. dbPath
selAddress <- selAddress <-
do case L.listSelectedElement $ s ^. abaddresses of do case L.listSelectedElement $ s ^. abAddresses of
Nothing -> do Nothing -> do
let fAdd = let fAdd =
L.listSelectedElement $ L.listMoveToBeginning $ s ^. abaddresses L.listSelectedElement $ L.listMoveToBeginning $ s ^. abAddresses
return fAdd return fAdd
Just a2 -> return $ Just a2 Just a2 -> return $ Just a2
case selAddress of case selAddress of
Nothing -> return s Nothing -> return s
Just (_i, a) -> do Just (_i, a) -> do
abookList <- getAdrBook pool (s ^. network) abookList <- getAdrBook pool (s ^. network)
let tL' = L.listReplace (Vec.fromList abookList) (Just 0) (s ^. abaddresses) let tL' = L.listReplace (Vec.fromList abookList) (Just 0) (s ^. abAddresses)
return $ s & abaddresses .~ tL' return $ s & abAddresses .~ tL'
addNewAddress :: T.Text -> Scope -> State -> IO State addNewAddress :: T.Text -> Scope -> State -> IO State
addNewAddress n scope s = do addNewAddress n scope s = do