-
Notifications
You must be signed in to change notification settings - Fork 982
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
Wallet - refresh activity after sending a transaction #19984
Changes from all commits
8423c6d
ab8d209
9bea703
865d8b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns quo.components.tabs.tabs.schema) | ||
|
||
(def ^:private ?data | ||
[:sequential | ||
[:maybe | ||
[:map | ||
[:id [:or :int :keyword [:set :int]]] | ||
[:label [:maybe :string]] | ||
[:accessibility-label {:optional true} [:maybe [:or :keyword :string]]] | ||
[:notification-dot? {:optional true} [:maybe :boolean]]]]]) | ||
|
||
(def ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map | ||
[:default-active {:optional true} [:maybe [:or :int :keyword]]] | ||
[:active-tab-id {:optional true} [:maybe [:or :int :keyword]]] | ||
[:data ?data] | ||
[:fade-end-percentage {:optional true} [:or :double :string]] | ||
[:fade-end? {:optional true} [:maybe :boolean]] | ||
[:blur? {:optional true} [:maybe :boolean]] | ||
[:on-change {:optional true} [:maybe fn?]] | ||
[:on-scroll {:optional true} [:maybe fn?]] | ||
[:scroll-on-press? {:optional true} [:maybe :boolean]] | ||
[:scrollable? {:optional true} [:maybe :boolean]] | ||
[:style {:optional true} [:maybe :map]] | ||
[:container-style {:optional true} [:maybe :map]] | ||
[:size {:optional true} [:maybe [:or :keyword :int]]] | ||
[:in-scroll-view? {:optional true} [:maybe :boolean]] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]]]] | ||
:any]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
(:require | ||
[quo.core :as quo] | ||
[react-native.core :as rn] | ||
[reagent.core :as reagent] | ||
[status-im.contexts.wallet.account.style :as style] | ||
[status-im.contexts.wallet.account.tabs.view :as tabs] | ||
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher] | ||
|
@@ -21,57 +20,58 @@ | |
(not watch-only?) (conj {:id :dapps :label (i18n/label :t/dapps) :accessibility-label :dapps}) | ||
true (conj {:id :about :label (i18n/label :t/about) :accessibility-label :about}))) | ||
|
||
(defn- change-tab [id] (rf/dispatch [:wallet/select-account-tab id])) | ||
|
||
(defn view | ||
[] | ||
(let [selected-tab (reagent/atom first-tab-id)] | ||
(fn [] | ||
(let [{:keys [name color formatted-balance | ||
watch-only?]} (rf/sub [:wallet/current-viewing-account]) | ||
customization-color (rf/sub [:profile/customization-color])] | ||
(rn/use-unmount #(rf/dispatch [:wallet/close-account-page])) | ||
[rn/view {:style {:flex 1}} | ||
[account-switcher/view | ||
{:type :wallet-networks | ||
:on-press #(rf/dispatch [:wallet/close-account-page])}] | ||
[quo/account-overview | ||
{:container-style style/account-overview | ||
:current-value formatted-balance | ||
:account-name name | ||
:account (if watch-only? :watched-address :default) | ||
:customization-color color}] | ||
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}]) | ||
(when (not watch-only?) | ||
[quo/wallet-ctas | ||
{:container-style style/cta-buttons | ||
:send-action (fn [] | ||
(rf/dispatch [:wallet/clean-send-data]) | ||
(rf/dispatch [:wallet/wizard-navigate-forward | ||
{:start-flow? true | ||
:flow-id :wallet-send-flow}])) | ||
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address | ||
{:status :receive}]) | ||
:buy-action #(rf/dispatch [:show-bottom-sheet | ||
{:content buy-token/view}]) | ||
:bridge-action (fn [] | ||
(rf/dispatch [:wallet/clean-send-data]) | ||
(rf/dispatch [:wallet/wizard-navigate-forward | ||
{:start-flow? true | ||
:flow-id :wallet-bridge-flow}])) | ||
:swap-action (when (ff/enabled? ::ff/wallet.swap) | ||
#(rf/dispatch [:wallet.swap/start]))}]) | ||
[quo/tabs | ||
{:style style/tabs | ||
:size 32 | ||
:default-active @selected-tab | ||
:data (tabs-data watch-only?) | ||
:on-change (rn/use-callback (fn [tab] (reset! selected-tab tab))) | ||
:scrollable? true | ||
:scroll-on-press? true}] | ||
[tabs/view {:selected-tab @selected-tab}] | ||
(when (ff/enabled? ::ff/shell.jump-to) | ||
[quo/floating-shell-button | ||
{:jump-to | ||
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) | ||
:customization-color customization-color | ||
:label (i18n/label :t/jump-to)}} | ||
style/shell-button])])))) | ||
(let [selected-tab (or (rf/sub [:wallet/account-tab]) first-tab-id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. selected tab is stored in the reframe db so we can go to the right tab after certain actions (e.g complete transaction) |
||
{:keys [name color formatted-balance | ||
watch-only?]} (rf/sub [:wallet/current-viewing-account]) | ||
customization-color (rf/sub [:profile/customization-color])] | ||
(rn/use-unmount #(rf/dispatch [:wallet/close-account-page])) | ||
[rn/view {:style {:flex 1}} | ||
[account-switcher/view | ||
{:type :wallet-networks | ||
:on-press #(rf/dispatch [:wallet/close-account-page])}] | ||
[quo/account-overview | ||
{:container-style style/account-overview | ||
:current-value formatted-balance | ||
:account-name name | ||
:account (if watch-only? :watched-address :default) | ||
:customization-color color}] | ||
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}]) | ||
(when (not watch-only?) | ||
[quo/wallet-ctas | ||
{:container-style style/cta-buttons | ||
:send-action (fn [] | ||
(rf/dispatch [:wallet/clean-send-data]) | ||
(rf/dispatch [:wallet/wizard-navigate-forward | ||
{:start-flow? true | ||
:flow-id :wallet-send-flow}])) | ||
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address | ||
{:status :receive}]) | ||
:buy-action #(rf/dispatch [:show-bottom-sheet | ||
{:content buy-token/view}]) | ||
:bridge-action (fn [] | ||
(rf/dispatch [:wallet/clean-send-data]) | ||
(rf/dispatch [:wallet/wizard-navigate-forward | ||
{:start-flow? true | ||
:flow-id :wallet-bridge-flow}])) | ||
:swap-action (when (ff/enabled? ::ff/wallet.swap) | ||
#(rf/dispatch [:wallet.swap/start]))}]) | ||
[quo/tabs | ||
{:style style/tabs | ||
:size 32 | ||
:active-tab-id selected-tab | ||
:data (tabs-data watch-only?) | ||
:on-change change-tab | ||
:scrollable? true | ||
:scroll-on-press? true}] | ||
[tabs/view {:selected-tab selected-tab}] | ||
(when (ff/enabled? ::ff/shell.jump-to) | ||
[quo/floating-shell-button | ||
{:jump-to | ||
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) | ||
:customization-color customization-color | ||
:label (i18n/label :t/jump-to)}} | ||
style/shell-button])])) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,7 +253,7 @@ | |
|
||
(rf/reg-event-fx | ||
:wallet/set-collectible-to-send | ||
(fn [{db :db} [{:keys [collectible current-screen]}]] | ||
(fn [{db :db} [{:keys [collectible current-screen start-flow?]}]] | ||
(let [collection-data (:collection-data collectible) | ||
collectible-data (:collectible-data collectible) | ||
contract-type (:contract-type collectible) | ||
|
@@ -282,6 +282,7 @@ | |
[:dispatch | ||
[:wallet/wizard-navigate-forward | ||
{:current-screen current-screen | ||
:start-flow? start-flow? | ||
:flow-id :wallet-send-flow}]]]}))) | ||
|
||
(rf/reg-event-fx | ||
|
@@ -447,18 +448,26 @@ | |
(assoc-in [:wallet :transactions] transaction-details) | ||
(assoc-in [:wallet :ui :send :transaction-ids] transaction-ids)) | ||
:fx [[:dispatch | ||
[:wallet/wizard-navigate-forward | ||
{:current-screen :screen/wallet.transaction-confirmation | ||
:flow-id :wallet-send-flow}]]]}))) | ||
[:wallet/end-transaction-flow]]]}))) | ||
Comment on lines
-450
to
+451
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we update the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes good point, I'll double check that. I see you had it in the similar pr so will check with that too 🙏 |
||
|
||
(rf/reg-event-fx :wallet/close-transaction-progress-page | ||
(rf/reg-event-fx :wallet/clean-up-transaction-flow | ||
(fn [_] | ||
{:fx [[:dispatch [:wallet/clean-scanned-address]] | ||
{:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]] | ||
[:dispatch [:wallet/clean-scanned-address]] | ||
[:dispatch [:wallet/clean-local-suggestions]] | ||
[:dispatch [:wallet/clean-send-address]] | ||
[:dispatch [:wallet/clean-disabled-from-networks]] | ||
[:dispatch [:wallet/select-address-tab nil]] | ||
[:dispatch [:dismiss-modal :screen/wallet.transaction-progress]]]})) | ||
[:dispatch [:wallet/select-address-tab nil]]]})) | ||
|
||
(rf/reg-event-fx :wallet/end-transaction-flow | ||
(fn [{:keys [db]}] | ||
(let [address (get-in db [:wallet :current-viewing-account-address])] | ||
{:fx [[:dispatch [:wallet/navigate-to-account-within-stack address]] | ||
[:dispatch [:wallet/fetch-activities]] | ||
[:dispatch [:wallet/select-account-tab :activity]] | ||
[:dispatch-later | ||
[{:ms 20 | ||
:dispatch [:wallet/clean-up-transaction-flow]}]]]}))) | ||
|
||
(defn- transaction-data | ||
[{:keys [from-address to-address token-address route data eth-transfer?]}] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs component now is controllable from outside with a prop for value.