rvv041 #82

Merged
pitmutt merged 30 commits from rvv041 into milestone2 2024-06-07 20:03:06 +00:00
3 changed files with 21 additions and 8 deletions
Showing only changes of commit edb7422951 - Show all commits

View file

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.5.2.0-beta] ## [0.5.2.0-beta]
### Added
pitmutt marked this conversation as resolved Outdated

These changes should be added as a new version [0.5.3.0-beta]

These changes should be added as a new version `[0.5.3.0-beta]`
- Address Book functionality. Allows users to store frequently used zcash addresses and
generate transactions using them.
### Changed ### Changed
- Update to `zcash-haskell-0.6.2.0` to increase performance of transaction creation - Update to `zcash-haskell-0.6.2.0` to increase performance of transaction creation

View file

@ -414,7 +414,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
(D.dialog (Just $ str " Delete Address Book Entry ") Nothing 50) (D.dialog (Just $ str " Delete Address Book Entry ") Nothing 50)
(renderForm (st ^. abForm) <=> (renderForm (st ^. abForm) <=>
C.hCenter C.hCenter
(hBox [capCommand "" " Delete", capCommand3 "" "<Esc>" " Cancel"])) (hBox [capCommand "C" "onfirm delete", capCommand3 "" "<Esc>" " Cancel"]))
-- --
splashDialog :: State -> Widget Name splashDialog :: State -> Widget Name
@ -1177,10 +1177,17 @@ appEvent (BT.VtyEvent e) = do
AddressField AddressField
-- Process delete AddresBook entry -- Process delete AddresBook entry
AdrBookDelForm -> do AdrBookDelForm -> do
case e of case e of
V.EvKey V.KEsc [] -> BT.modify $ set dialogBox AdrBook V.EvKey V.KEsc [] -> BT.modify $ set dialogBox AdrBook
V.EvKey V.KEnter [] -> BT.modify $ set dialogBox AdrBook V.EvKey (V.KChar 'c') [] -> do
ev -> BT.modify $ set dialogBox AdrBookDelForm pool <- liftIO $ runNoLoggingT $ initPool $ s ^. dbPath
fs <- BT.zoom abForm $ BT.gets formState
res <- liftIO $ deleteAdrsFromAB pool (fs ^.address)
s' <- liftIO $ refreshAddressBook s
BT.put s'
BT.modify $ set dialogBox AdrBook
ev -> BT.modify $ set dialogBox AdrBookDelForm
-- Process any other event
Blank -> do Blank -> do
case e of case e of
V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext

View file

@ -1504,6 +1504,7 @@ updateAdrsInAdrBook pool d a ia = do
set ab [AddressBookDescrip =. val d, AddressBookAddress =. val a] set ab [AddressBookDescrip =. val d, AddressBookAddress =. val a]
where_ $ ab ^. AddressBookAddress ==. val ia where_ $ ab ^. AddressBookAddress ==. val ia
-- | Get one AddrssBook record using the Address as a key
getABookRec :: ConnectionPool -> T.Text -> IO [Entity AddressBook] getABookRec :: ConnectionPool -> T.Text -> IO [Entity AddressBook]
pitmutt marked this conversation as resolved Outdated

If this function is intended to provide only one record, it should return a IO (Maybe (Entity AddressBook))

If this function is intended to provide only one record, it should return a `IO (Maybe (Entity AddressBook))`
getABookRec pool a = do getABookRec pool a = do
runNoLoggingT $ runNoLoggingT $
@ -1515,14 +1516,14 @@ getABookRec pool a = do
return adrbook return adrbook
-- | delete an existing address from AddressBook -- | delete an existing address from AddressBook
deleteAdrsFromAB :: ConnectionPool -> AddressBookId -> IO () deleteAdrsFromAB :: ConnectionPool -> T.Text -> IO ()
deleteAdrsFromAB pool i = do deleteAdrsFromAB pool ia = do
runNoLoggingT $ runNoLoggingT $
PS.retryOnBusy $ PS.retryOnBusy $
flip PS.runSqlPool pool $ do flip PS.runSqlPool pool $ do
delete $ do delete $ do
ab <- from $ table @AddressBook ab <- from $ table @AddressBook
where_ (ab ^. AddressBookId ==. val i) where_ (ab ^. AddressBookAddress ==. val ia)
rmdups :: Ord a => [a] -> [a] rmdups :: Ord a => [a] -> [a]
rmdups = map head . group . sort rmdups = map head . group . sort