[#6283] fix unknown chat after transaction

This commit is contained in:
Roman Volosovskyi 2018-10-15 10:57:55 +03:00
parent d09a2956c3
commit 9d1debbf28
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 9 additions and 22 deletions

View File

@ -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

View File

@ -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]}]

View File

@ -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))}