Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed Dec 19, 2023
1 parent ba3ea1e commit aeba072
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/quo/components/drawers/drawer_top/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
[rn/view {:style style/title-container}
[text/text
{:size :heading-2
:weight :semi-bold}
:weight :semi-bold
:style {:color (when blur? colors/white)}}
title]
(when title-icon
[icons/icon title-icon
Expand Down
10 changes: 10 additions & 0 deletions src/status_im2/contexts/wallet/common/utils.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns status-im2.contexts.wallet.common.utils
(:require [clojure.string :as string]
[status-im2.common.qr-codes.view :as qr-codes]
[status-im2.constants :as constants]
[utils.money :as money]
[utils.number]))
Expand Down Expand Up @@ -86,3 +87,12 @@
(defn calculate-fiat-change
[fiat-value change-pct-24hour]
(money/bignumber (* fiat-value (/ change-pct-24hour (+ 100 change-pct-24hour)))))

(defn get-wallet-qr
[{:keys [wallet-type selected-networks address]}]
(if (= wallet-type :wallet-multichain)
(as-> selected-networks $
(map qr-codes/get-network-short-name-url $)
(apply str $)
(str $ address))
address))
18 changes: 18 additions & 0 deletions src/status_im2/contexts/wallet/common/utils_test.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(ns status-im2.contexts.wallet.common.utils-test
(:require [clojure.test :refer :all]
[status-im2.contexts.wallet.common.utils :as utils]))

(defn test-get-wallet-qr
(testing "Test get-wallet-qr function"
(let [wallet-multichain {:wallet-type :wallet-multichain
:selected-networks [:ethereum :optimism]
:address "x000"}
wallet-singlechain {:wallet-type :wallet-singlechain
:selected-networks [:ethereum :optimism]
:address "x000"}]

(is (= (utils/get-wallet-qr wallet-multichain)
"eth:opt:x000"))

(is (= (utils/get-wallet-qr wallet-singlechain)
"x000")))))
12 changes: 5 additions & 7 deletions src/status_im2/contexts/wallet/receive/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
[status-im2.contexts.wallet.receive.style :as style]
[utils.i18n :as i18n]
[utils.image-server :as image-server]
[utils.re-frame :as rf]))
[utils.re-frame :as rf]
[status-im2.contexts.wallet.common.utils :as utils]))

(def id-to-network
{constants/mainnet-chain-id :ethereum
Expand Down Expand Up @@ -56,12 +57,9 @@
(fn []
(let [{:keys [address color emoji] :as account} (rf/sub [:wallet/current-viewing-account])
share-title (str (:name account) " " (i18n/label :t/address))
qr-url (if (= @wallet-type :wallet-multichain)
(as-> @selected-networks $
(map qr-codes/get-network-short-name-url $)
(apply str $)
(str $ address))
address)
qr-url (utils/get-wallet-qr {:wallet-type @wallet-type
:selected-networks @selected-networks
:address address})
qr-media-server-uri (image-server/get-qr-image-uri-for-any-url
{:url qr-url
:port (rf/sub [:mediaserver/port])
Expand Down

0 comments on commit aeba072

Please sign in to comment.