chore(wallet): hide share button on scanner pages except universal scanner

This commit is contained in:
Jamie Caprani 2024-05-21 17:11:04 +02:00 committed by GitHub
parent 32123d2f69
commit ed88170c5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 14 deletions

View File

@ -20,7 +20,7 @@
(defonce camera-permission-granted? (reagent/atom false)) (defonce camera-permission-granted? (reagent/atom false))
(defn- header (defn- header
[{:keys [title subtitle]}] [{:keys [title subtitle share-button?]}]
[:<> [:<>
[rn/view {:style style/header-container} [rn/view {:style style/header-container}
[quo/button [quo/button
@ -31,16 +31,17 @@
:accessibility-label :close-scan-qr-code :accessibility-label :close-scan-qr-code
:on-press #(rf/dispatch [:navigate-back])} :on-press #(rf/dispatch [:navigate-back])}
:i/close] :i/close]
[quo/button (when share-button?
{:icon-only? true [quo/button
:type :grey {:icon-only? true
:background :blur :type :grey
:size 32 :background :blur
:accessibility-label :show-qr-button :size 32
:on-press (fn [] :accessibility-label :show-qr-button
(rf/dispatch [:navigate-back]) :on-press (fn []
(rf/dispatch [:open-modal :screen/share-shell]))} (rf/dispatch [:navigate-back])
:i/qr-code]] (rf/dispatch [:open-modal :screen/share-shell]))}
:i/qr-code])]
[quo/text [quo/text
{:size :heading-1 {:size :heading-1
:weight :semi-bold :weight :semi-bold
@ -195,7 +196,7 @@
true) true)
(defn view (defn view
[{:keys [title subtitle validate-fn on-success-scan error-message]}] [{:keys [title subtitle validate-fn on-success-scan error-message share-button?]}]
(let [insets (safe-area/get-insets) (let [insets (safe-area/get-insets)
qr-code-succeed? (reagent/atom false) qr-code-succeed? (reagent/atom false)
qr-view-finder (reagent/atom {}) qr-view-finder (reagent/atom {})
@ -237,8 +238,9 @@
:set-rescan-timeout set-rescan-timeout}]) :set-rescan-timeout set-rescan-timeout}])
[rn/view {:style (style/root-container (:top insets))} [rn/view {:style (style/root-container (:top insets))}
[header [header
{:title title {:title title
:subtitle subtitle}] :subtitle subtitle
:share-button? share-button?}]
(when (empty? @qr-view-finder) (when (empty? @qr-view-finder)
[:<> [:<>
[rn/view {:style style/scan-qr-code-container}] [rn/view {:style style/scan-qr-code-container}]

View File

@ -118,6 +118,7 @@
(rn/dismiss-keyboard!)) (rn/dismiss-keyboard!))
[scan-qr-code/view [scan-qr-code/view
{:title (i18n/label :t/scan-qr) {:title (i18n/label :t/scan-qr)
:share-button? true
:on-success-scan on-qr-code-scanned}]])) :on-success-scan on-qr-code-scanned}]]))
(defn view (defn view