-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: hook up qr scanner on watch only flow
- Loading branch information
Showing
12 changed files
with
113 additions
and
115 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/status_im2/contexts/wallet/add_address_to_watch/confirm_address/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(ns status-im2.contexts.wallet.add-address-to-watch.confirm-address.style) | ||
|
||
(def header-container | ||
{:margin-horizontal 20 | ||
:margin-top 12 | ||
:margin-bottom 20}) | ||
|
||
(def button-container | ||
{:position :absolute | ||
:bottom 44 | ||
:left 20 | ||
:right 20}) |
73 changes: 73 additions & 0 deletions
73
src/status_im2/contexts/wallet/add_address_to_watch/confirm_address/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
(ns status-im2.contexts.wallet.add-address-to-watch.confirm-address.view | ||
(:require | ||
clojure.string | ||
[quo.core :as quo] | ||
[re-frame.core :as re-frame] | ||
[react-native.core :as rn] | ||
[react-native.safe-area :as safe-area] | ||
[reagent.core :as reagent] | ||
[status-im2.constants :as constants] | ||
[status-im2.contexts.wallet.add-address-to-watch.confirm-address.style :as style] | ||
[utils.debounce :as debounce] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn- address-input | ||
[input-value] | ||
(let [valid-ens-or-address? (rf/sub [:wallet/valid-ens-or-address?]) | ||
scanned-address (rf/sub [:wallet/scanned-address]) | ||
on-change-text (fn [text] | ||
(let [starts-like-eth-address (re-matches | ||
constants/regx-address-fragment | ||
text)] | ||
(when (and scanned-address (not= scanned-address text)) | ||
(rf/dispatch [:wallet/clean-scanned-address])) | ||
(if starts-like-eth-address | ||
(rf/dispatch [:wallet/fetch-address-suggestions text]) | ||
(rf/dispatch [:wallet/clean-local-suggestions])) | ||
(reset! input-value text)))] | ||
[quo/address-input | ||
{:on-scan #(rf/dispatch [:open-modal :scan-address]) | ||
:ens-regex constants/regx-ens | ||
:address-regex constants/regx-address | ||
:scanned-value scanned-address | ||
:on-detect-ens #(debounce/debounce-and-dispatch | ||
[:wallet/validate-ens %] | ||
300) | ||
:on-detect-address #(debounce/debounce-and-dispatch | ||
[:wallet/validate-address %] | ||
300) | ||
:on-change-text on-change-text | ||
:on-clear #(rf/dispatch [:wallet/clean-scanned-address]) | ||
:valid-ens-or-address? valid-ens-or-address?}])) | ||
|
||
(defn f-view | ||
[] | ||
(rf/dispatch [:wallet/clean-scanned-address]) | ||
(let [customization-color (rf/sub [:profile/customization-color]) | ||
input-value (reagent/atom "")] | ||
(fn [] | ||
[rn/view | ||
{:style {:flex 1 | ||
:margin-top (safe-area/get-top)}} | ||
[quo/page-nav | ||
{:type :no-title | ||
:icon-name :i/close | ||
:on-press #(rf/dispatch [:navigate-back])}] | ||
[quo/text-combinations | ||
{:container-style style/header-container | ||
:title (i18n/label :t/add-address) | ||
:description (i18n/label :t/enter-eth)}] | ||
[address-input input-value] | ||
[quo/button | ||
{:customization-color customization-color | ||
:disabled? (clojure.string/blank? @input-value) | ||
:on-press #(re-frame/dispatch [:navigate-to | ||
:add-address-to-watch | ||
{:address @input-value}]) | ||
:container-style style/button-container} | ||
(i18n/label :t/continue)]]))) | ||
|
||
(defn view | ||
[] | ||
[:f> f-view]) |
9 changes: 9 additions & 0 deletions
9
src/status_im2/contexts/wallet/add_address_to_watch/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns status-im2.contexts.wallet.add-address-to-watch.style) | ||
|
||
(def container | ||
{:flex 1}) | ||
|
||
(def data-item | ||
{:margin-horizontal 20 | ||
:padding-vertical 8 | ||
:padding-horizontal 12}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/status_im2/contexts/wallet/add_watch_only_account/style.cljs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/status_im2/contexts/wallet/select_address_to_watch/style.cljs
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
src/status_im2/contexts/wallet/select_address_to_watch/view.cljs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters