Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(wallet): hide share button on scanner page #20105

Merged
merged 8 commits into from
May 21, 2024
30 changes: 16 additions & 14 deletions src/status_im/common/scan_qr_code/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(defonce camera-permission-granted? (reagent/atom false))

(defn- header
[{:keys [title subtitle]}]
[{:keys [title subtitle share-button?]}]
[:<>
[rn/view {:style style/header-container}
[quo/button
Expand All @@ -31,16 +31,17 @@
:accessibility-label :close-scan-qr-code
:on-press #(rf/dispatch [:navigate-back])}
:i/close]
[quo/button
{:icon-only? true
:type :grey
:background :blur
:size 32
:accessibility-label :show-qr-button
:on-press (fn []
(rf/dispatch [:navigate-back])
(rf/dispatch [:open-modal :screen/share-shell]))}
:i/qr-code]]
(when share-button?
[quo/button
{:icon-only? true
:type :grey
:background :blur
:size 32
:accessibility-label :show-qr-button
:on-press (fn []
(rf/dispatch [:navigate-back])
(rf/dispatch [:open-modal :screen/share-shell]))}
:i/qr-code])]
[quo/text
{:size :heading-1
:weight :semi-bold
Expand Down Expand Up @@ -195,7 +196,7 @@
true)

(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)
qr-code-succeed? (reagent/atom false)
qr-view-finder (reagent/atom {})
Expand Down Expand Up @@ -237,8 +238,9 @@
:set-rescan-timeout set-rescan-timeout}])
[rn/view {:style (style/root-container (:top insets))}
[header
{:title title
:subtitle subtitle}]
{:title title
:subtitle subtitle
:share-button? share-button?}]
(when (empty? @qr-view-finder)
[:<>
[rn/view {:style style/scan-qr-code-container}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
[scan-qr-code/view
{:title (i18n/label :t/scan-qr)
:subtitle (i18n/label :t/scan-an-account-qr-code)
:share-button? false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is redundant since if it is not passed its value would be nil

Also, I see we have 3 instances of scan-qr-code/view so we need to pass :share-button? true to the ones where we need the share button (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you're right. I'll swap the order of this and set the other ones to true and remove this 👍
thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I think the other instances don't need it. Only the universal scanner does

:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
:validate-fn #(contains-supported-address? %)
:on-success-scan (fn [result]
Expand Down