[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)
|
(assoc :current-chat-id console-chat-id)
|
||||||
(dissoc :transactions
|
(dissoc :transactions
|
||||||
:transactions-queue
|
:transactions-queue
|
||||||
|
:wallet
|
||||||
:contacts/new-identity))))
|
:contacts/new-identity))))
|
||||||
|
|
||||||
(register-handler-fx
|
(register-handler-fx
|
||||||
|
@ -268,14 +269,14 @@
|
||||||
:chat
|
:chat
|
||||||
:accounts)]
|
:accounts)]
|
||||||
(merge
|
(merge
|
||||||
{:db (assoc db :view-id view
|
{:db (assoc db
|
||||||
:navigation-stack (list view))}
|
:view-id view
|
||||||
(when (or (empty? accounts) open-console?)
|
:navigation-stack (list view))}
|
||||||
{:dispatch-n (concat
|
(when (or (empty? accounts) open-console?)
|
||||||
[[:init-console-chat]
|
{:dispatch-n (concat [[:init-console-chat]
|
||||||
[:load-commands!]]
|
[:load-commands!]]
|
||||||
(when open-console?
|
(when open-console?
|
||||||
[[:navigate-to :chat console-chat-id]]))})))))
|
[[:navigate-to :chat console-chat-id]]))})))))
|
||||||
|
|
||||||
(register-handler-fx
|
(register-handler-fx
|
||||||
:initialize-crypt
|
:initialize-crypt
|
||||||
|
|
|
@ -71,3 +71,8 @@
|
||||||
:align-items :center
|
:align-items :center
|
||||||
:justify-content :center
|
:justify-content :center
|
||||||
:background-color (str styles/color-black "1A")})
|
: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 []
|
(defview send-transaction-modal []
|
||||||
(letsubs [transaction [:wallet.send/unsigned-transaction]]
|
(letsubs [transaction [:wallet.send/unsigned-transaction]]
|
||||||
(let [{:keys [amount amount-error signing? to to-name sufficient-funds? in-progress? from-chat?]} transaction]
|
(if transaction
|
||||||
[react/keyboard-avoiding-view wallet.styles/wallet-modal-container
|
(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
|
[react/view components.styles/flex
|
||||||
[status-bar/status-bar {:type :modal-wallet}]
|
[status-bar/status-bar {:type :modal-wallet}]
|
||||||
[toolbar-modal from-chat?]
|
[toolbar-modal false]
|
||||||
[common/network-info {:text-color :white}]
|
[react/text {:style send.styles/empty-text} (i18n/label :t/unsigned-transaction-expired)]]])))
|
||||||
[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])]])))
|
|
||||||
|
|
|
@ -37,16 +37,16 @@
|
||||||
:gas (money/to-decimal gas)
|
:gas (money/to-decimal gas)
|
||||||
:gas-price (money/to-decimal gasPrice)
|
:gas-price (money/to-decimal gasPrice)
|
||||||
:timestamp now
|
:timestamp now
|
||||||
:message-id message_id}]
|
:message-id message_id}
|
||||||
|
sending-from-chat? (not (get-in db [:wallet :send-transaction :waiting-signal?]))]
|
||||||
(merge
|
(merge
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:wallet :transactions-unsigned id] transaction)
|
(assoc-in [:wallet :transactions-unsigned id] transaction)
|
||||||
(assoc-in [:wallet :send-transaction :id] id))}
|
(assoc-in [:wallet :send-transaction :id] id)
|
||||||
(if (get-in db [:wallet :send-transaction :waiting-signal?])
|
(assoc-in [:wallet :send-transaction :from-chat?] sending-from-chat?))}
|
||||||
;;sending from wallet
|
(if sending-from-chat?
|
||||||
{:dispatch [:wallet.send-transaction/transaction-queued id]}
|
{:dispatch [:navigate-to-modal :wallet-send-transaction-modal]}
|
||||||
;;sending from chat
|
{:dispatch [:wallet.send-transaction/transaction-queued id]})))
|
||||||
{:dispatch [:navigate-to-modal :wallet-send-transaction-modal id :from-chat]})))
|
|
||||||
{:discard-transaction id})))
|
{:discard-transaction id})))
|
||||||
|
|
||||||
;;TRANSACTION FAILED signal from status-go
|
;;TRANSACTION FAILED signal from status-go
|
||||||
|
|
Loading…
Reference in New Issue