rvv041 #82
3 changed files with 21 additions and 8 deletions
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [0.5.2.0-beta]
|
||||
|
||||
### Added
|
||||
pitmutt marked this conversation as resolved
Outdated
|
||||
|
||||
- Address Book functionality. Allows users to store frequently used zcash addresses and
|
||||
generate transactions using them.
|
||||
|
||||
### Changed
|
||||
|
||||
- Update to `zcash-haskell-0.6.2.0` to increase performance of transaction creation
|
||||
|
|
|
@ -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)
|
||||
(renderForm (st ^. abForm) <=>
|
||||
C.hCenter
|
||||
(hBox [capCommand "↲" " Delete", capCommand3 "" "<Esc>" " Cancel"]))
|
||||
(hBox [capCommand "C" "onfirm delete", capCommand3 "" "<Esc>" " Cancel"]))
|
||||
--
|
||||
|
||||
splashDialog :: State -> Widget Name
|
||||
|
@ -1177,10 +1177,17 @@ appEvent (BT.VtyEvent e) = do
|
|||
AddressField
|
||||
-- Process delete AddresBook entry
|
||||
AdrBookDelForm -> do
|
||||
case e of
|
||||
V.EvKey V.KEsc [] -> BT.modify $ set dialogBox AdrBook
|
||||
V.EvKey V.KEnter [] -> BT.modify $ set dialogBox AdrBook
|
||||
ev -> BT.modify $ set dialogBox AdrBookDelForm
|
||||
case e of
|
||||
V.EvKey V.KEsc [] -> BT.modify $ set dialogBox AdrBook
|
||||
V.EvKey (V.KChar 'c') [] -> do
|
||||
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
|
||||
case e of
|
||||
V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext
|
||||
|
|
|
@ -1504,6 +1504,7 @@ updateAdrsInAdrBook pool d a ia = do
|
|||
set ab [AddressBookDescrip =. val d, AddressBookAddress =. val a]
|
||||
where_ $ ab ^. AddressBookAddress ==. val ia
|
||||
|
||||
-- | Get one AddrssBook record using the Address as a key
|
||||
getABookRec :: ConnectionPool -> T.Text -> IO [Entity AddressBook]
|
||||
pitmutt marked this conversation as resolved
Outdated
pitmutt
commented
If this function is intended to provide only one record, it should return a If this function is intended to provide only one record, it should return a `IO (Maybe (Entity AddressBook))`
|
||||
getABookRec pool a = do
|
||||
runNoLoggingT $
|
||||
|
@ -1515,14 +1516,14 @@ getABookRec pool a = do
|
|||
return adrbook
|
||||
|
||||
-- | delete an existing address from AddressBook
|
||||
deleteAdrsFromAB :: ConnectionPool -> AddressBookId -> IO ()
|
||||
deleteAdrsFromAB pool i = do
|
||||
deleteAdrsFromAB :: ConnectionPool -> T.Text -> IO ()
|
||||
deleteAdrsFromAB pool ia = do
|
||||
runNoLoggingT $
|
||||
PS.retryOnBusy $
|
||||
flip PS.runSqlPool pool $ do
|
||||
delete $ do
|
||||
ab <- from $ table @AddressBook
|
||||
where_ (ab ^. AddressBookId ==. val i)
|
||||
where_ (ab ^. AddressBookAddress ==. val ia)
|
||||
|
||||
rmdups :: Ord a => [a] -> [a]
|
||||
rmdups = map head . group . sort
|
||||
|
|
Loading…
Reference in a new issue
These changes should be added as a new version
[0.5.3.0-beta]