rvv001 - Issue 0085 - URI support implemented in GUI

- "Processing URI ..." message added
                    - QR image Display for Transparent, Sapling and Unified
		       address added.
This commit is contained in:
Rene V. Vergara 2025-01-16 16:09:45 -05:00
parent ee71b7acbb
commit c1f0d86f14

View file

@ -175,6 +175,7 @@ data AppEvent
| PrepareURIString
| CloseShowURIOverlay
| ShowURIOverlay !(Maybe URIQrCode) !T.Text
| QRImageLoaded
| CopyURIString !T.Text
| DisplayPayUsingURI
| ClosePayUsingURI
@ -252,6 +253,7 @@ data AppModel = AppModel
, _uriString :: !T.Text
, _uriAddr :: !T.Text
, _uriQRImage :: !(Maybe URIQrCode)
, _uriQRInProgress :: !Bool
} deriving (Eq, Show)
makeLenses ''AppModel
@ -318,6 +320,7 @@ buildUI wenv model = widgetTree
, dfBalOverlay `nodeVisible` model ^. displayFIATBalance
, showVKOverlay `nodeVisible` model ^. viewingKeyDisplay
, paymentURIOverlay `nodeVisible` model ^. paymentURIDisplay
, showURIInProgress `nodeVisible` model ^. uriQRInProgress
, showURIOverlay `nodeVisible` model ^. showURIDisplay
, pmtUsingURIOverlay `nodeVisible` model ^. usepmtURIOverlay
, msgAdrBookOverlay `nodeVisible` isJust (model ^. msgAB)
@ -1322,7 +1325,21 @@ buildUI wenv model = widgetTree
, filler
]) `styleBasic`
[bgColor (white & L.a .~ 0.5)]
--
--
showURIInProgress =
box
(vstack
[ filler
, hstack
[ filler
, label "Processing Payment URI, it will take a moment ....."
`styleBasic` [textFont "Bold", textSize 14]
, filler
]
, filler
]) `styleBasic`
[bgColor (white & L.a .~ 0.5)]
--
showURIOverlay =
box
(vstack
@ -1345,9 +1362,9 @@ buildUI wenv model = widgetTree
[ filler
, box_
[alignMiddle]
-- (image_ (T.pack ((model ^. home) </> "Zenith/assets/qr_image.png")) [fitFill])
(case model ^. uriQRImage of
Just img -> imageMem_ "URIQRCode" (uriBytes img) (Size (uriWidth img) (uriHeight img) ) [fitWidth]
Just img -> imageMem_ "URIQRCode" (uriBytes img) (Size (uriWidth img) (uriHeight img) )
[fitWidth]
Nothing -> image_
(T.pack $ (model ^. home) </> "Zenith/assets/cracked_qr.png")
[fitHeight] )
@ -1356,7 +1373,7 @@ buildUI wenv model = widgetTree
, width 120
]
, filler
]
]
, spacer
, hstack
[ filler
@ -1910,15 +1927,20 @@ handleEvent wenv node model evt =
--
-- Generate URI
--
PrepareURIString -> [ Task $ genURIString (model ^. uriAddr) (model ^. sendAmount) (model ^. sendMemo) ]
PrepareURIString -> [ Task $ genURIString (model ^. uriAddr) (model ^. sendAmount) (model ^. sendMemo)
, Model $ model & uriQRInProgress .~ True
]
ShowURIOverlay qr uStr ->
[ Model $
model & uriString .~ uStr
& uriQRImage .~ qr
& uriQRInProgress .~ True
& paymentURIDisplay .~ False
& showURIDisplay .~ True
& uriQRInProgress .~ False
]
CloseShowURIOverlay -> [ Model $ model & showURIDisplay .~ False & uriString .~ "" & uriQRImage .~ Nothing]
CloseShowURIOverlay -> [ Model $ model & showURIDisplay .~ False & uriString .~ "" & uriQRInProgress .~ False & uriQRImage .~ Nothing]
QRImageLoaded -> [ Model $ model & uriQRInProgress .~ False ]
--
-- Display Pay using URI Form
--
@ -2557,6 +2579,7 @@ runZenithGUI config = do
""
""
Nothing
False
startApp model handleEvent buildUI (params hD)
Left _e -> print "Zebra not available"
where