From 9d1debbf2836a76f5e39bd916f381b9d81ea0db8 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Mon, 15 Oct 2018 10:57:55 +0300 Subject: [PATCH] [#6283] fix unknown chat after transaction --- .../ui/screens/wallet/send/events.cljs | 7 +------ .../ui/screens/wallet/send/views.cljs | 6 +++--- .../screens/wallet/transaction_fee/views.cljs | 18 +++++------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/status_im/ui/screens/wallet/send/events.cljs b/src/status_im/ui/screens/wallet/send/events.cljs index 41c381bd52..9099e2efe6 100644 --- a/src/status_im/ui/screens/wallet/send/events.cljs +++ b/src/status_im/ui/screens/wallet/send/events.cljs @@ -261,17 +261,12 @@ cofx) :dispatch [:wallet/update-gas-price true])))) -(fx/defn navigate-after-transaction [{:keys [db] :as cofx} chat-id] - (if (= :wallet-send-transaction-modal (second (:navigation-stack db))) - (chat.models/navigate-to-chat cofx chat-id {}) - (navigation/navigate-back cofx))) - (handlers/register-handler-fx :close-transaction-sent-screen (fn [cofx [_ chat-id]] (fx/merge cofx {:dispatch-later [{:ms 400 :dispatch [:check-dapps-transactions-queue]}]} - (navigate-after-transaction chat-id)))) + (navigation/navigate-back)))) (handlers/register-handler-fx :sync-wallet-transactions diff --git a/src/status_im/ui/screens/wallet/send/views.cljs b/src/status_im/ui/screens/wallet/send/views.cljs index 374fc5ad93..b817f47e82 100644 --- a/src/status_im/ui/screens/wallet/send/views.cljs +++ b/src/status_im/ui/screens/wallet/send/views.cljs @@ -10,7 +10,7 @@ [status-im.ui.components.react :as react] [status-im.ui.components.status-bar.view :as status-bar] [status-im.ui.components.styles :as components.styles] - [status-im.ui.components.toolbar.actions :as act] + [status-im.ui.components.toolbar.actions :as actions] [status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.tooltip.views :as tooltip] [status-im.ui.screens.wallet.components.styles :as wallet.components.styles] @@ -31,11 +31,11 @@ [status-im.ui.components.colors :as colors])) (defn- toolbar [modal? title] - (let [action (if modal? act/close-white act/back-white)] + (let [action (if modal? actions/close-white actions/back-white)] [toolbar/toolbar {:style wallet.styles/toolbar} [toolbar/nav-button (action (if modal? #(re-frame/dispatch [:wallet/discard-transaction-navigate-back]) - #(act/default-handler)))] + #(actions/default-handler)))] [toolbar/content-title {:color :white} title]])) (defn- advanced-cartouche [{:keys [max-fee gas gas-price]}] diff --git a/src/status_im/ui/screens/wallet/transaction_fee/views.cljs b/src/status_im/ui/screens/wallet/transaction_fee/views.cljs index 6e4909c16e..0420a8bca5 100644 --- a/src/status_im/ui/screens/wallet/transaction_fee/views.cljs +++ b/src/status_im/ui/screens/wallet/transaction_fee/views.cljs @@ -16,16 +16,9 @@ [status-im.utils.ethereum.tokens :as tokens] [status-im.utils.ethereum.core :as ethereum])) -(defn return-to-transaction [modal?] - (if modal? - ;;TODO(andrey) artificial navigation stack for modals (should be reworked) - ;; ^ probably will be fixed with react-navigation - (re-frame/dispatch [:navigate-to-clean :wallet-send-transaction-modal]) - (act/default-handler))) - -(defn- toolbar [modal? title] +(defn- toolbar [title] [toolbar/toolbar {:style wallet.styles/toolbar} - [toolbar/nav-button (act/close-white #(return-to-transaction modal?))] + [toolbar/nav-button (act/close-white act/default-handler)] [toolbar/content-title {:color :white} title]]) (defview transaction-fee [] @@ -34,13 +27,12 @@ {gas-edit :gas max-fee :max-fee gas-price-edit :gas-price} [:wallet/edit]] - (let [modal? (:id send-transaction) - {:keys [amount symbol]} send-transaction + (let [{:keys [amount symbol]} send-transaction gas (:value gas-edit) gas-price (:value gas-price-edit) {:keys [decimals]} (tokens/asset-for (ethereum/network->chain-keyword network) symbol)] [components/simple-screen {:status-bar-type :modal-wallet} - [toolbar modal? (i18n/label :t/wallet-transaction-fee)] + [toolbar (i18n/label :t/wallet-transaction-fee)] [react/view components.styles/flex [react/view {:flex-direction :row} @@ -99,7 +91,7 @@ [button/button {:on-press #(do (re-frame/dispatch [:wallet.send/set-gas-details (:value-number gas-edit) (:value-number gas-price-edit)]) - (return-to-transaction modal?)) + (act/default-handler)) :accessibility-label :done-button :disabled? (or (:invalid? gas-edit) (:invalid? gas-price-edit))}