chore(navigation): qualify wallet screen keywords (#18778)

This commit is contained in:
Jamie Caprani 2024-03-12 11:22:04 +00:00 committed by GitHub
parent 637efa24cf
commit 2931ae84ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 95 additions and 87 deletions

View File

@ -98,7 +98,7 @@
[cofx {address :account}]
(when-let [account (existing-account? cofx address)]
(navigation/navigate-to cofx
:wallet-account
:screen/wallet.accounts
account)))
(defn handle-not-found

View File

@ -28,4 +28,4 @@
:on-token-press (fn [token]
(rf/dispatch [:wallet/bridge-select-token
{:token token
:stack-id :wallet-bridge}]))}]])))
:stack-id :screen/wallet.bridge}]))}]])))

View File

@ -11,10 +11,10 @@
[]
[rn/view {:style style/bridge-send-wrapper}
[input-amount/view
{:current-screen-id :wallet-bridge-send
{:current-screen-id :screen/wallet.bridge-send
:button-one-label (i18n/label :t/confirm-bridge)
:button-one-props {:icon-left :i/bridge}
:on-navigate-back (fn []
(rf/dispatch [:navigate-back-within-stack :wallet-bridge-send]))}]])
(rf/dispatch [:navigate-back-within-stack :screen/wallet.bridge-send]))}]])
(def view (quo.theme/with-theme view-internal))

View File

@ -3,7 +3,7 @@
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[quo.theme :as quo.theme]
[quo.theme]
[react-native.core :as rn]
[status-im.contexts.wallet.account.bridge-to.style :as style]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
@ -48,7 +48,7 @@
{:name (string/upper-case (str (:name token)))})]
[rn/view
[account-switcher/view
{:on-press #(rf/dispatch [:navigate-back-within-stack :wallet-bridge-to])
{:on-press #(rf/dispatch [:navigate-back-within-stack :screen/wallet.bridge-to])
:icon-name :i/arrow-left
:accessibility-label :top-bar}]
[quo/page-top {:title bridge-to-title}]

View File

@ -52,7 +52,7 @@
{:icon :i/qr-code
:accessibility-label :show-address-qr
:label (i18n/label :t/show-address-qr)
:on-press #(rf/dispatch [:open-modal :wallet-share-address {:status :share}])}
:on-press #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :share}])}
{:icon :i/share
:accessibility-label :share-address
:label (i18n/label :t/share-address)

View File

@ -51,8 +51,8 @@
[quo/wallet-ctas
{:send-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:open-modal :wallet-select-address]))
:receive-action #(rf/dispatch [:open-modal :wallet-share-address {:status :receive}])
(rf/dispatch [:open-modal :screen/wallet.select-address]))
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-drawer}])
:bridge-action #(ff/alert ::ff/wallet.bridge-token

View File

@ -65,7 +65,7 @@
{:type :outline
:on-press (fn []
(rn/dismiss-keyboard!)
(rf/dispatch [:open-modal :scan-address]))
(rf/dispatch [:open-modal :screen/wallet.scan-address]))
:container-style style/scan
:size 40
:icon-only? true}
@ -137,7 +137,7 @@
(not validated-address))
:on-press (fn []
(rf/dispatch [:navigate-to
:confirm-address-to-watch
:screen/wallet.confirm-address-to-watch
{:address validated-address}])
(clear-input))
:container-style {:z-index 2}}

View File

@ -20,7 +20,7 @@
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/send-select-token-drawer {:token token-data}])
(rf/dispatch [:open-modal :wallet-select-address]))}
(rf/dispatch [:open-modal :screen/wallet.select-address]))}
{:icon :i/receive
:accessibility-label :receive
:label (i18n/label :t/receive)

View File

@ -80,7 +80,7 @@
(reset! show-error? false)
(when (= @quiz-index questions-count)
(rf/dispatch [:navigate-to
:wallet-keypair-name])))
:screen/wallet.keypair-name])))
(do
(when (> @incorrect-count 0)
(rf/dispatch [:show-bottom-sheet

View File

@ -16,7 +16,7 @@
[[{:icon :i/add
:accessibility-label :generate-new-keypair
:label (i18n/label :t/generate-new-keypair)
:on-press #(rf/dispatch [:navigate-to :wallet-backup-recovery-phrase])}
:on-press #(rf/dispatch [:navigate-to :screen/wallet.backup-recovery-phrase])}
{:icon :i/seed
:accessibility-label :import-using-phrase
:label (i18n/label :t/import-using-phrase)

View File

@ -32,7 +32,7 @@
:customization-color account-color})
:action (when-not keypair-name :button)
:action-props {:on-press (fn []
(rf/dispatch [:navigate-to :wallet-select-keypair]))
(rf/dispatch [:navigate-to :scrren/wallet.select-keypair]))
:button-text (i18n/label :t/edit)
:alignment :flex-start}
:description :text

View File

@ -30,13 +30,13 @@
(rf/reg-event-fx :wallet/navigate-to-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:navigate-to :wallet-accounts address]]]}))
:fx [[:dispatch [:navigate-to :screen/wallet.accounts address]]]}))
(rf/reg-event-fx :wallet/navigate-to-new-account
(fn [{:keys [db]} [address]]
{:db (assoc-in db [:wallet :current-viewing-account-address] address)
:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch [:navigate-to :wallet-accounts address]]
[:dispatch [:navigate-to :screen/wallet.accounts address]]
[:dispatch [:wallet/show-account-created-toast address]]]}))
(rf/reg-event-fx :wallet/switch-current-viewing-account
@ -240,17 +240,17 @@
{:db (-> db
(assoc-in [:wallet :ui :send :token] token)
(assoc-in [:wallet :ui :send :to-address] to-address))
:fx [[:dispatch [:navigate-to-within-stack [:wallet-bridge-to stack-id]]]]})))
:fx [[:dispatch [:navigate-to-within-stack [:screen/wallet.bridge-to stack-id]]]]})))
(rf/reg-event-fx :wallet/start-bridge
(fn [{:keys [db]}]
{:db (assoc-in db [:wallet :ui :send :type] :bridge)
:fx [[:dispatch [:open-modal :wallet-bridge]]]}))
:fx [[:dispatch [:open-modal :screen/wallet.bridge]]]}))
(rf/reg-event-fx :wallet/select-bridge-network
(fn [{:keys [db]} [{:keys [network-chain-id stack-id]}]]
{:db (assoc-in db [:wallet :ui :send :bridge-to-chain-id] network-chain-id)
:fx [[:dispatch [:navigate-to-within-stack [:wallet-bridge-send stack-id]]]]}))
:fx [[:dispatch [:navigate-to-within-stack [:screen/wallet.bridge-send stack-id]]]]}))
(rf/reg-event-fx
:wallet/get-ethereum-chains
@ -410,7 +410,7 @@
{:db (-> db
(assoc-in [:wallet :ui :create-account :secret-phrase] secret-phrase)
(assoc-in [:wallet :ui :create-account :random-phrase] random-phrase))
:fx [[:dispatch-later [{:ms 20 :dispatch [:navigate-to :wallet-check-your-backup]}]]]})
:fx [[:dispatch-later [{:ms 20 :dispatch [:navigate-to :screens/wallet.check-your-backup]}]]]})
(rf/reg-event-fx :wallet/store-secret-phrase store-secret-phrase)

View File

@ -45,7 +45,7 @@
(defn store-last-collectible-details
[{:keys [db]} [collectible]]
{:db (assoc-in db [:wallet :last-collectible-details] collectible)
:dispatch [:navigate-to :wallet-collectible]})
:dispatch [:navigate-to :screen/wallet.collectible]})
(rf/reg-event-fx :wallet/store-last-collectible-details store-last-collectible-details)

View File

@ -18,12 +18,12 @@
:accessibility-label :start-a-new-chat
:label (i18n/label :t/add-account)
:sub-label (i18n/label :t/add-account-description)
:on-press #(rf/dispatch [:navigate-to :wallet-create-account])}
:on-press #(rf/dispatch [:navigate-to :screen/wallet.create-account])}
{:icon :i/reveal
:accessibility-label :add-a-contact
:label (i18n/label :t/add-address)
:sub-label (i18n/label :t/add-address-description)
:on-press #(rf/dispatch [:navigate-to :add-address-to-watch])
:on-press #(rf/dispatch [:navigate-to :screen/wallet.add-address-to-watch])
:add-divider? true}]]])
(defn- new-account-card-data

View File

@ -67,8 +67,8 @@
:fx [[:dispatch
[:navigate-to-within-stack
(if token?
[:wallet-send-input-amount stack-id]
[:wallet-select-asset stack-id])]]]})))
[:screen/wallet.send-input-amount stack-id]
[:screen/wallet.select-asset stack-id])]]]})))
(rf/reg-event-fx
:wallet/update-receiver-networks
@ -81,7 +81,7 @@
(update-in [:wallet :ui :send] dissoc :collectible)
(assoc-in [:wallet :ui :send :token] token))
:fx [[:dispatch [:wallet/clean-suggested-routes]]
[:dispatch [:navigate-to-within-stack [:wallet-send-input-amount stack-id]]]]}))
[:dispatch [:navigate-to-within-stack [:screen/wallet.send-input-amount stack-id]]]]}))
(rf/reg-event-fx
:wallet/send-select-token-drawer
@ -110,12 +110,12 @@
(assoc-in [:wallet :ui :send :type] :collectible)
(assoc-in [:wallet :ui :send :amount] 1))
:fx [[:dispatch [:wallet/get-suggested-routes {:amount 1}]]
[:navigate-to-within-stack [:wallet-transaction-confirmation stack-id]]]}))
[:navigate-to-within-stack [:screen/wallet.transaction-confirmation stack-id]]]}))
(rf/reg-event-fx :wallet/send-select-amount
(fn [{:keys [db]} [{:keys [amount stack-id]}]]
{:db (assoc-in db [:wallet :ui :send :amount] amount)
:fx [[:dispatch [:navigate-to-within-stack [:wallet-transaction-confirmation stack-id]]]]}))
:fx [[:dispatch [:navigate-to-within-stack [:screen/wallet.transaction-confirmation stack-id]]]]}))
(rf/reg-event-fx :wallet/get-suggested-routes
(fn [{:keys [db now]} [{:keys [amount]}]]
@ -185,11 +185,11 @@
(assoc-in [:wallet :ui :send :transaction-ids] transaction-ids))
:fx [[:dispatch
[:navigate-to-within-stack
[:wallet-transaction-progress :wallet-transaction-confirmation]]]]})))
[:screen/wallet.transaction-progress :screen/wallet.transaction-confirmation]]]]})))
(rf/reg-event-fx :wallet/close-transaction-progress-page
(fn [_]
{:fx [[:dispatch [:dismiss-modal :wallet-transaction-progress]]]}))
{:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-progress]]]}))
(defn- transaction-bridge
[{:keys [from-address from-chain-id to-address token-id token-address route data eth-transfer?]}]

View File

@ -53,7 +53,7 @@
:eip1559-enabled true}}]
:wallet/wallet-send-suggested-routes {:candidates []}
:wallet/wallet-send-selected-networks []
:navigation/current-screen-id :wallet-send-input-amount
:navigation/current-screen-id :screen/wallet.send-input-amount
:wallet/wallet-send-to-address "0x04371e2d9d66b82f056bc128064"
:profile/currency-symbol "$"
:wallet/token-by-symbol {:symbol :eth

View File

@ -16,7 +16,7 @@
{:address address
:token? false
:recipient account
:stack-id :wallet-select-address}])}])
:stack-id :screen/wallet.select-address}])}])
(defn my-accounts
[theme]

View File

@ -38,12 +38,12 @@
:on-scan (fn []
(rn/dismiss-keyboard!)
(rf/dispatch [:wallet/clean-scanned-address])
(rf/dispatch [:open-modal :scan-address]))
(rf/dispatch [:open-modal :screen/wallet.scan-address]))
:ens-regex constants/regx-ens
:scanned-value (or (when recipient-plain-address? send-address) scanned-address)
:address-regex constants/regx-multichain-address
:on-detect-address #(when (or (= current-screen-id :wallet-select-address)
(= current-screen-id :scan-address))
:on-detect-address #(when (or (= current-screen-id :screen/wallet.select-address)
(= current-screen-id :screen/wallet.scan-address))
; ^ this check is to prevent effect being triggered when screen is
; loaded but not being shown to the user (deep in the navigation
; stack) and avoid undesired behaviors
@ -51,8 +51,8 @@
[:wallet/validate-address %]
300))
:on-detect-ens (fn [text cb]
(when (or (= current-screen-id :wallet-select-address)
(= current-screen-id :scan-address))
(when (or (= current-screen-id :screen/wallet.select-address)
(= current-screen-id :screen/wallet.scan-address))
; ^ this check is to prevent effect being triggered when screen
; is loaded but not being shown to the user (deep in the
; navigation stack) and avoid undesired behaviors
@ -95,7 +95,7 @@
{:address address
:token? false
:recipient local-suggestion
:stack-id :wallet-select-address}]))))
:stack-id :screen/wallet.select-address}]))))
:active-state? false}]
(cond
(= type types/saved-address)
@ -154,11 +154,12 @@
{:accessibility-label :continue-button
:type :primary
:disabled? (not valid-ens-or-address?)
:on-press #(rf/dispatch [:wallet/select-send-address
{:address @input-value
:token? (some? token)
:stack-id
:wallet-select-address}])
:on-press #(rf/dispatch
[:wallet/select-send-address
{:address @input-value
:token? (some? token)
:stack-id
:screen/wallet.select-address}])
:customization-color color}
(i18n/label :t/continue)])}
[quo/page-top

View File

@ -36,7 +36,7 @@
:on-end-reached #(rf/dispatch [:wallet/request-collectibles-for-current-viewing-account])
:on-collectible-press #(rf/dispatch [:wallet/send-select-collectible
{:collectible %
:stack-id :wallet-select-asset}])}]))
:stack-id :screen/wallet.select-asset}])}]))
(defn- tab-view
[search-text selected-tab on-change-text]
(let [unfiltered-collectibles (rf/sub [:wallet/current-viewing-account-collectibles])
@ -46,7 +46,7 @@
on-token-press (fn [token]
(rf/dispatch [:wallet/send-select-token
{:token token
:stack-id :wallet-select-asset}]))]
:stack-id :screen/wallet.select-asset}]))]
[:<>
(when show-search-input?
[search-input search-text on-change-text])
@ -63,7 +63,7 @@
search-text (reagent/atom "")
on-change-text #(reset! search-text %)
on-change-tab #(reset! selected-tab %)
on-close #(rf/dispatch [:navigate-back-within-stack :wallet-select-asset])]
on-close #(rf/dispatch [:navigate-back-within-stack :screen/wallet.select-asset])]
(fn []
[rn/safe-area-view {:style style/container}
[account-switcher/view

View File

@ -8,11 +8,11 @@
(defn- view-internal
[]
[input-amount/view
{:current-screen-id :wallet-send-input-amount
{:current-screen-id :screen/wallet.send-input-amount
:button-one-label (i18n/label :t/confirm)
:on-navigate-back (fn []
(rf/dispatch [:wallet/clean-selected-token])
(rf/dispatch [:wallet/clean-selected-collectible])
(rf/dispatch [:navigate-back-within-stack :wallet-send-input-amount]))}])
(rf/dispatch [:navigate-back-within-stack :screen/wallet.send-input-amount]))}])
(def view (quo.theme/with-theme view-internal))

View File

@ -238,7 +238,7 @@
(defn- view-internal
[_]
(let [on-close (fn []
(rf/dispatch [:navigate-back-within-stack :wallet-transaction-confirmation])
(rf/dispatch [:navigate-back-within-stack :screen/wallet.transaction-confirmation])
(rf/dispatch [:wallet/clean-suggested-routes])
(rf/dispatch [:wallet/clean-selected-collectible]))]
(fn [{:keys [theme]}]

View File

@ -71,7 +71,7 @@
[[{:icon :i/edit
:accessibility-label :edit
:label (i18n/label :t/edit-account)
:on-press #(rf/dispatch [:navigate-to :wallet-edit-account])}
:on-press #(rf/dispatch [:navigate-to :screen/wallet.edit-account])}
{:icon :i/copy
:accessibility-label :copy-address
:label (i18n/label :t/copy-address)
@ -83,7 +83,7 @@
{:icon :i/qr-code
:accessibility-label :show-address-qr
:label (i18n/label :t/show-address-qr)
:on-press #(rf/dispatch [:open-modal :wallet-share-address {:status :share}])}
:on-press #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :share}])}
{:icon :i/share
:accessibility-label :share-account
:label (i18n/label :t/share-address)

View File

@ -52,12 +52,13 @@
[status-im.contexts.syncing.scan-sync-code-page.view :as scan-sync-code-page]
[status-im.contexts.syncing.setup-syncing.view :as settings-setup-syncing]
[status-im.contexts.syncing.syncing-devices-list.view :as settings-syncing]
[status-im.contexts.wallet.account.bridge-send.view :as bridge-send]
[status-im.contexts.wallet.account.bridge-to.view :as bridge-to]
[status-im.contexts.wallet.account.bridge.view :as bridge]
[status-im.contexts.wallet.account.bridge-send.view :as wallet-bridge-send]
[status-im.contexts.wallet.account.bridge-to.view :as wallet-bridge-to]
[status-im.contexts.wallet.account.bridge.view :as wallet-bridge]
[status-im.contexts.wallet.account.view :as wallet-accounts]
[status-im.contexts.wallet.add-address-to-watch.confirm-address.view :as confirm-address-to-watch]
[status-im.contexts.wallet.add-address-to-watch.view :as add-address-to-watch]
[status-im.contexts.wallet.add-address-to-watch.confirm-address.view :as
wallet-confirm-address-to-watch]
[status-im.contexts.wallet.add-address-to-watch.view :as wallet-add-address-to-watch]
[status-im.contexts.wallet.collectible.view :as wallet-collectible]
[status-im.contexts.wallet.create-account.edit-derivation-path.view :as wallet-edit-derivation-path]
[status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.view :as
@ -69,7 +70,7 @@
[status-im.contexts.wallet.create-account.view :as wallet-create-account]
[status-im.contexts.wallet.edit-account.view :as wallet-edit-account]
[status-im.contexts.wallet.saved-addresses.view :as wallet-saved-addresses]
[status-im.contexts.wallet.scan-account.view :as scan-address]
[status-im.contexts.wallet.scan-account.view :as wallet-scan-address]
[status-im.contexts.wallet.send.select-address.view :as wallet-select-address]
[status-im.contexts.wallet.send.select-asset.view :as wallet-select-asset]
[status-im.contexts.wallet.send.send-amount.view :as wallet-send-input-amount]
@ -327,95 +328,95 @@
:options {:sheet? true}
:component emoji-picker/view}
{:name :wallet-accounts
{:name :screen/wallet.accounts
:options {:insets {:top? true}
:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}
:component wallet-accounts/view}
{:name :wallet-edit-account
{:name :screen/wallet.edit-account
:component wallet-edit-account/view}
{:name :add-address-to-watch
{:name :screen/wallet.add-address-to-watch
:options {:insets {:top? true}}
:component add-address-to-watch/view}
:component wallet-add-address-to-watch/view}
{:name :confirm-address-to-watch
:component confirm-address-to-watch/view}
{:name :screen/wallet.confirm-address-to-watch
:component wallet-confirm-address-to-watch/view}
{:name :wallet-bridge
{:name :screen/wallet.bridge
:options {:insets {:top? true}
:modalPresentationStyle :overCurrentContext}
:component bridge/view}
:component wallet-bridge/view}
{:name :wallet-bridge-to
{:name :screen/wallet.bridge-to
:options {:insets {:top? true}}
:component bridge-to/view}
:component wallet-bridge-to/view}
{:name :wallet-bridge-send
{:name :screen/wallet.bridge-send
:options {:insets {:top? true}}
:component bridge-send/view}
:component wallet-bridge-send/view}
{:name :wallet-edit-derivation-path
{:name :screen/wallet.edit-derivation-path
:component wallet-edit-derivation-path/view}
{:name :wallet-collectible
{:name :screen/wallet.collectible
:component wallet-collectible/view}
{:name :wallet-select-keypair
{:name :screen/wallet.select-keypair
:options {:insets {:top? true :bottom? true}}
:component wallet-select-keypair/view}
{:name :wallet-create-account
{:name :screen/wallet.create-account
:options {:insets {:top? true}}
:component wallet-create-account/view}
{:name :wallet-backup-recovery-phrase
{:name :screen/wallet.backup-recovery-phrase
:options {:insets {:top? true :bottom? true}}
:component wallet-backup-recovery-phrase/view}
{:name :wallet-check-your-backup
{:name :screen/wallet.check-your-backup
:options {:insets {:top? true :bottom? true}}
:component wallet-check-your-backup/view}
{:name :wallet-keypair-name
{:name :screen/wallet.keypair-name
:options {:insets {:top? true :bottom? true}}
:component wallet-keypair-name/view}
{:name :wallet-share-address
{:name :screen/wallet.share-address
:options options/transparent-screen-options
:component wallet-share-address/view}
{:name :wallet-saved-addresses
{:name :screen/wallet.saved-addresses
:component wallet-saved-addresses/view}
{:name :wallet-send-input-amount
{:name :screen/wallet.send-input-amount
:options {:modalPresentationStyle :overCurrentContext
:insets {:top? true
:bottom? true}}
:component wallet-send-input-amount/view}
{:name :wallet-select-address
{:name :screen/wallet.select-address
:options {:modalPresentationStyle :overCurrentContext
:insets {:top? true}}
:component wallet-select-address/view}
{:name :wallet-select-asset
{:name :screen/wallet.select-asset
:options {:insets {:top? true}}
:component wallet-select-asset/view}
{:name :wallet-transaction-confirmation
{:name :screen/wallet.transaction-confirmation
:component wallet-transaction-confirmation/view}
{:name :wallet-transaction-progress
{:name :screen/wallet.transaction-progress
:component wallet-transaction-progress/view}
{:name :scan-address
{:name :screen/wallet.scan-address
:options (merge
options/dark-screen
{:modalPresentationStyle :overCurrentContext})
:component scan-address/view}
:component wallet-scan-address/view}
{:name :scan-profile-qr-code
:options (merge

View File

@ -56,12 +56,18 @@
(defn screen
[screen-key]
(reagent.core/reactify-component
(fn []
(let [{:keys [component options]} (get (if js/goog.DEBUG
(let [screen-details (get (if js/goog.DEBUG
(get-screens)
screens)
(keyword screen-key))
qualified-screen-details (get (if js/goog.DEBUG
(get-screens)
screens)
(keyword "screen" screen-key))
{:keys [component options]} (or qualified-screen-details screen-details)
{:keys [insets sheet? theme]} options
user-theme (theme/get-theme)
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])