[bug] fix #2132 clear unsigned transactions when switching account
- works with PR #2137
This commit is contained in:
parent
0707af2ad6
commit
0564551782
|
@ -238,6 +238,7 @@
|
|||
(assoc :current-chat-id console-chat-id)
|
||||
(dissoc :transactions
|
||||
:transactions-queue
|
||||
:wallet
|
||||
:contacts/new-identity))))
|
||||
|
||||
(register-handler-fx
|
||||
|
@ -268,14 +269,14 @@
|
|||
:chat
|
||||
:accounts)]
|
||||
(merge
|
||||
{:db (assoc db :view-id view
|
||||
:navigation-stack (list view))}
|
||||
(when (or (empty? accounts) open-console?)
|
||||
{:dispatch-n (concat
|
||||
[[:init-console-chat]
|
||||
[:load-commands!]]
|
||||
(when open-console?
|
||||
[[:navigate-to :chat console-chat-id]]))})))))
|
||||
{:db (assoc db
|
||||
:view-id view
|
||||
:navigation-stack (list view))}
|
||||
(when (or (empty? accounts) open-console?)
|
||||
{:dispatch-n (concat [[:init-console-chat]
|
||||
[:load-commands!]]
|
||||
(when open-console?
|
||||
[[:navigate-to :chat console-chat-id]]))})))))
|
||||
|
||||
(register-handler-fx
|
||||
:initialize-crypt
|
||||
|
@ -315,7 +316,7 @@
|
|||
"handler-result" (let [orig-params (:origParams data)]
|
||||
;; TODO(janherich): figure out and fix chat_id from event
|
||||
(dispatch [:command-handler! (:chat-id orig-params) orig-params
|
||||
{:result {:returned (dissoc data :origParams)}}]))
|
||||
{:result {:returned (dissoc data :origParams)}}]))
|
||||
(log/debug "Unknown jail signal " event))))
|
||||
|
||||
(register-handler-fx
|
||||
|
|
|
@ -71,3 +71,8 @@
|
|||
:align-items :center
|
||||
:justify-content :center
|
||||
:background-color (str styles/color-black "1A")})
|
||||
|
||||
(def empty-text
|
||||
{:text-align :center
|
||||
:margin-top 22
|
||||
:margin-horizontal 92})
|
||||
|
|
|
@ -145,33 +145,39 @@
|
|||
|
||||
(defview send-transaction-modal []
|
||||
(letsubs [transaction [:wallet.send/unsigned-transaction]]
|
||||
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction]
|
||||
[react/keyboard-avoiding-view wallet.styles/wallet-modal-container
|
||||
(if transaction
|
||||
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction]
|
||||
[react/keyboard-avoiding-view wallet.styles/wallet-modal-container
|
||||
[react/view components.styles/flex
|
||||
[status-bar/status-bar {:type :modal-wallet}]
|
||||
[toolbar-modal from-chat?]
|
||||
[common/network-info {:text-color :white}]
|
||||
[react/scroll-view {:keyboardShouldPersistTaps :always}
|
||||
[react/view components.styles/flex
|
||||
[react/view wallet.styles/choose-participant-container
|
||||
[components/choose-recipient-disabled {:address to
|
||||
:name to-name}]]
|
||||
[react/view wallet.styles/choose-wallet-container
|
||||
[components/choose-wallet]]
|
||||
[react/view wallet.styles/amount-container
|
||||
[components/amount-input
|
||||
{:error (when-not sufficient-funds? (i18n/label :t/wallet-insufficient-funds))
|
||||
:disabled? true
|
||||
:input-options {:default-value amount}}]
|
||||
[react/view wallet.styles/choose-currency-container
|
||||
[components/choose-currency wallet.styles/choose-currency]]]]]
|
||||
[components/separator]
|
||||
(if signing?
|
||||
[signing-buttons
|
||||
#(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])])
|
||||
(when signing?
|
||||
[sign-panel])
|
||||
(when in-progress? [react/view send.styles/processing-view])]])
|
||||
[react/view wallet.styles/wallet-modal-container
|
||||
[react/view components.styles/flex
|
||||
[status-bar/status-bar {:type :modal-wallet}]
|
||||
[toolbar-modal from-chat?]
|
||||
[common/network-info {:text-color :white}]
|
||||
[react/scroll-view {:keyboardShouldPersistTaps :always}
|
||||
[react/view components.styles/flex
|
||||
[react/view wallet.styles/choose-participant-container
|
||||
[components/choose-recipient-disabled {:address to
|
||||
:name to-name}]]
|
||||
[react/view wallet.styles/choose-wallet-container
|
||||
[components/choose-wallet]]
|
||||
[react/view wallet.styles/amount-container
|
||||
[components/amount-input
|
||||
{:error (when-not sufficient-funds? (i18n/label :t/wallet-insufficient-funds))
|
||||
:disabled? true
|
||||
:input-options {:default-value amount}}]
|
||||
[react/view wallet.styles/choose-currency-container
|
||||
[components/choose-currency wallet.styles/choose-currency]]]]]
|
||||
[components/separator]
|
||||
(if signing?
|
||||
[signing-buttons
|
||||
#(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])])
|
||||
(when signing?
|
||||
[sign-panel])
|
||||
(when in-progress? [react/view send.styles/processing-view])]])))
|
||||
[toolbar-modal false]
|
||||
[react/text {:style send.styles/empty-text} (i18n/label :t/unsigned-transaction-expired)]]])))
|
||||
|
|
|
@ -37,16 +37,16 @@
|
|||
:gas (money/to-decimal gas)
|
||||
:gas-price (money/to-decimal gasPrice)
|
||||
:timestamp now
|
||||
:message-id message_id}]
|
||||
:message-id message_id}
|
||||
sending-from-chat? (not (get-in db [:wallet :send-transaction :waiting-signal?]))]
|
||||
(merge
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :transactions-unsigned id] transaction)
|
||||
(assoc-in [:wallet :send-transaction :id] id))}
|
||||
(if (get-in db [:wallet :send-transaction :waiting-signal?])
|
||||
;;sending from wallet
|
||||
{:dispatch [:wallet.send-transaction/transaction-queued id]}
|
||||
;;sending from chat
|
||||
{:dispatch [:navigate-to-modal :wallet-send-transaction-modal id :from-chat]})))
|
||||
(assoc-in [:wallet :send-transaction :id] id)
|
||||
(assoc-in [:wallet :send-transaction :from-chat?] sending-from-chat?))}
|
||||
(if sending-from-chat?
|
||||
{:dispatch [:navigate-to-modal :wallet-send-transaction-modal]}
|
||||
{:dispatch [:wallet.send-transaction/transaction-queued id]})))
|
||||
{:discard-transaction id})))
|
||||
|
||||
;;TRANSACTION FAILED signal from status-go
|
||||
|
|
Loading…
Reference in New Issue