From 9a348390d3bee503355bacf49948ff6331d141bf Mon Sep 17 00:00:00 2001 From: Goran Jovic Date: Mon, 25 Jun 2018 09:36:21 +0200 Subject: [PATCH] bug #4921 - adds a workaround for the conflicting bugs #4876 and #4755 Signed-off-by: Igor Mandrigin --- .../ui/screens/wallet/send/events.cljs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/status_im/ui/screens/wallet/send/events.cljs b/src/status_im/ui/screens/wallet/send/events.cljs index 875a0448d6..d58d15448b 100644 --- a/src/status_im/ui/screens/wallet/send/events.cljs +++ b/src/status_im/ui/screens/wallet/send/events.cljs @@ -142,6 +142,20 @@ :in-progress? false :password nil}) +;; TODO(goranjovic) - this is a temporary workaround because in regular `clear-send-properties` we need `:from-chat?` +;; to be false to avoid the wallet onboarding crash if the user accessed transactions from dapps first. +;; On the other hand, if we reset the same flag to false every time we clear the current transaction that would also +;; happen when user clicks Cancel in chat initiated transaction and then all fields would become editable, which is +;; another bug. +;; This temporary workaround resets all fields except the flag if we are in a chat /send transaction. +;; A permanent solution would be to add onboarding check to dapp transaction and/or review the workflow. +(def ^:private partial-clear-send-properties {:id nil + :signing? false + :wrong-password? false + :waiting-signal? false + :in-progress? false + :password nil}) + (defn on-transactions-completed [raw-results] (let [result (types/json->clj raw-results)] (dispatch-transaction-completed result))) @@ -362,8 +376,9 @@ (defn discard-transaction [{:keys [db]}] - (let [{:keys [id]} (get-in db [:wallet :send-transaction])] - (merge {:db (update-in db [:wallet :send-transaction] merge clear-send-properties)} + (let [{:keys [id from-chat?]} (get-in db [:wallet :send-transaction]) + clear-fields (if from-chat? partial-clear-send-properties clear-send-properties)] + (merge {:db (update-in db [:wallet :send-transaction] merge clear-fields)} (when id {:discard-transaction id}))))