[feature] user feedbacks related to unsigned transaction

- in unsigned transaction tab, show the transaction sent screen when user
signs a transaction
- in send command flow, show dialog when users want to sign later
This commit is contained in:
Eric Dvorsak 2017-10-17 10:30:23 +02:00 committed by Roman Volosovskyi
parent e1d655789d
commit 3b824d1821
4 changed files with 46 additions and 33 deletions

View File

@ -20,10 +20,9 @@
::send-transaction
(fn [{:keys [web3] :as params}]
(when web3
(.sendTransaction
(.-eth web3)
(clj->js (select-keys params [:from :to :value]))
#()))))
(.sendTransaction (.-eth web3)
(clj->js (select-keys params [:from :to :value]))
#()))))
(re-frame/reg-fx
::show-transaction-moved
@ -75,7 +74,8 @@
{:db (-> db'
(update-in [:wallet :transactions-unsigned] dissoc id)
(update-in [:wallet :send-transaction] merge clear-send-properties))
:dispatch [:navigate-back]}))))
:dispatch-n [[:navigate-back]
[:navigate-to :wallet-transaction-sent]]}))))
(defn on-transactions-modal-completed [raw-results]
(let [results (:results (types/json->clj raw-results))]

View File

@ -4,6 +4,13 @@
[status-im.utils.money :as money]
[status-im.utils.hex :as utils.hex]))
(re-frame/reg-sub :wallet.sent/close-transaction-screen-event
:<- [:get :navigation-stack]
(fn [navigation-stack]
(case (second navigation-stack)
:wallet-send-transaction [:navigate-to-clean :wallet]
[:navigate-back])))
(re-frame/reg-sub ::send-transaction
:<- [:wallet]
(fn [wallet]

View File

@ -12,27 +12,28 @@
[status-im.utils.platform :as platform]))
(defview transaction-sent []
[react/view wallet.styles/wallet-modal-container
[status-bar/status-bar {:type :transparent}]
[react/view styles/transaction-sent-container
[react/view styles/ok-icon-container
[vi/icon :icons/ok {:color components.styles/color-blue4}]]
[react/text {:style styles/transaction-sent
:font (if platform/android? :medium :default)}
(i18n/label :t/transaction-sent)]
[react/view styles/gap]
[react/text {:style styles/transaction-sent-description} (i18n/label :t/transaction-description)]]
[react/view components.styles/flex]
[react/touchable-highlight {:on-press #()}; TODO (andrey) #(re-frame/dispatch [:navigate-to-clean :wallet-transaction-details])}
[react/view styles/transaction-details-container
[react/text {:style styles/transaction-details
:font (if platform/android? :medium :default)
:uppercase? (get-in platform/platform-specific [:uppercase?])}
(i18n/label :t/view-transaction-details)]]]
[components/separator]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to-clean :wallet])}
[react/view styles/got-it-container
[react/text {:style styles/got-it
:font (if platform/android? :medium :default)
:uppercase? (get-in platform/platform-specific [:uppercase?])}
(i18n/label :t/got-it)]]]])
(letsubs [close-transaction-screen-event [:wallet.sent/close-transaction-screen-event]]
[react/view wallet.styles/wallet-modal-container
[status-bar/status-bar {:type :transparent}]
[react/view styles/transaction-sent-container
[react/view styles/ok-icon-container
[vi/icon :icons/ok {:color components.styles/color-blue4}]]
[react/text {:style styles/transaction-sent
:font (if platform/android? :medium :default)}
(i18n/label :t/transaction-sent)]
[react/view styles/gap]
[react/text {:style styles/transaction-sent-description} (i18n/label :t/transaction-description)]]
[react/view components.styles/flex]
[react/touchable-highlight {:on-press #()}; TODO (andrey) #(re-frame/dispatch [:navigate-to-clean :wallet-transaction-details])}
[react/view styles/transaction-details-container
[react/text {:style styles/transaction-details
:font (if platform/android? :medium :default)
:uppercase? (get-in platform/platform-specific [:uppercase?])}
(i18n/label :t/view-transaction-details)]]]
[components/separator]
[react/touchable-highlight {:on-press #(re-frame/dispatch close-transaction-screen-event)}
[react/view styles/got-it-container
[react/text {:style styles/got-it
:font (if platform/android? :medium :default)
:uppercase? (get-in platform/platform-specific [:uppercase?])}
(i18n/label :t/got-it)]]]]))

View File

@ -26,11 +26,14 @@
act/default-handler))]
[toolbar/content-title {:color :white} (i18n/label :t/send-transaction)]])
(defn sign-later []
(defn sign-later-popup
[from-chat?]
(utils/show-question
(i18n/label :t/sign-later-title)
(i18n/label :t/sign-later-text)
#(re-frame/dispatch [:wallet/sign-transaction true])))
#(re-frame/dispatch (if from-chat?
[:navigate-back]
[:wallet/sign-transaction true]))))
(defview sign-panel []
(letsubs [account [:get-current-account]
@ -136,7 +139,7 @@
#(re-frame/dispatch [:wallet/discard-transaction])
#(re-frame/dispatch [:wallet/sign-transaction])
in-progress?]
[sign-buttons amount-error to-address amount sufficient-funds? sign-later])
[sign-buttons amount-error to-address amount sufficient-funds? #(sign-later-popup false)])
(when signing?
[sign-panel])]
(when in-progress? [react/view send.styles/processing-view])])))
@ -177,7 +180,9 @@
#(re-frame/dispatch [:wallet/cancel-signing-modal])
#(re-frame/dispatch [:wallet/sign-transaction-modal])
in-progress?]
[sign-buttons amount-error to amount sufficient-funds? #(re-frame/dispatch [:navigate-back])])
[sign-buttons amount-error to amount sufficient-funds? (if from-chat?
#(sign-later-popup true)
#(re-frame/dispatch [:navigate-back]))])
(when signing?
[sign-panel])
(when in-progress? [react/view send.styles/processing-view])]])