[#18934] universal scanner in wallet receive (#19409)

* Fix linear-gradient breaking when `customization-color` is unknown

* Fix exception when scanning an address due to non-existing navigation route

* Dispatches universal QR code scanner on share address modal
This commit is contained in:
Ulises Manuel 2024-03-27 10:01:28 -06:00 committed by GitHub
parent 9e71fc2d14
commit 7de1f95054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 20 deletions

View File

@ -12,9 +12,9 @@
;; the `:or` destructuring won't work because it's only applied when the ;; the `:or` destructuring won't work because it's only applied when the
;; `:customization-color` key is non-existent. While deleting an account the key exists ;; `:customization-color` key is non-existent. While deleting an account the key exists
;; and has a `nil` value. ;; and has a `nil` value.
(when customization-color (let [color-top (colors/resolve-color customization-color 50 20)
(let [color-top (colors/resolve-color customization-color 50 20) color-bottom (colors/resolve-color customization-color 50 0)]
color-bottom (colors/resolve-color customization-color 50 0)] (when (and color-top color-bottom)
[linear-gradient/linear-gradient [linear-gradient/linear-gradient
{:accessibility-label :gradient-cover {:accessibility-label :gradient-cover
:colors [color-top color-bottom] :colors [color-top color-bottom]

View File

@ -100,8 +100,7 @@
:or {customization-color :blue}}] :or {customization-color :blue}}]
(let [time-frame-string (time-string time-frame time-frame-string) (let [time-frame-string (time-string time-frame time-frame-string)
up? (= metrics :positive)] up? (= metrics :positive)]
[rn/view [rn/view {:style style/account-overview-wrapper}
{:style style/account-overview-wrapper}
(if (= :loading state) (if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)] [loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[rn/view [rn/view
@ -113,19 +112,17 @@
:size :heading-1 :size :heading-1
:style style/current-value} :style style/current-value}
current-value] current-value]
[rn/view [rn/view {:style style/row-centered}
{:style style/row-centered} (when (seq time-frame-string)
[:<> [text/text
(when (seq time-frame-string) {:weight :medium
[text/text :size :paragraph-2
{:weight :medium :style (style/bottom-time-text (and (not= :custom time-frame)
:size :paragraph-2 (seq time-frame-to-string)))}
:style (style/bottom-time-text (and (not= :custom time-frame) time-frame-string])
(seq time-frame-to-string)))} (when (and (= :custom time-frame)
time-frame-string]) (seq time-frame-to-string))
(when (and (= :custom time-frame) [custom-time-frame time-frame-to-string])
(seq time-frame-to-string))
[custom-time-frame time-frame-to-string])]
(when (and (seq percentage-change) (when (and (seq percentage-change)
(seq currency-change)) (seq currency-change))
[numeric-changes percentage-change currency-change customization-color theme up?])]])])) [numeric-changes percentage-change currency-change customization-color theme up?])]])]))

View File

@ -88,7 +88,7 @@
(load-and-show-profile scanned-text) (load-and-show-profile scanned-text)
(eth-address? scanned-text) (eth-address? scanned-text)
(debounce/debounce-and-dispatch [:navigate-to :wallet-accounts scanned-text] 300) (debounce/debounce-and-dispatch [:navigate-to :screen/wallet.accounts scanned-text] 300)
(eip681-address? scanned-text) (eip681-address? scanned-text)
(do (do

View File

@ -83,7 +83,9 @@
:on-press #(rf/dispatch [:navigate-back]) :on-press #(rf/dispatch [:navigate-back])
:background :blur :background :blur
:right-side [{:icon-name :i/scan :right-side [{:icon-name :i/scan
:on-press #(js/alert "To be implemented")}] :on-press (fn []
(rf/dispatch [:navigate-back])
(rf/dispatch [:open-modal :shell-qr-reader]))}]
:accessibility-label :top-bar}] :accessibility-label :top-bar}]
[quo/page-top [quo/page-top
{:title title {:title title