Add processing indicator when creating multiaccount

Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
Vitaliy Vlasov 2019-08-22 13:59:07 +03:00
parent 564090d7e6
commit 4c545cb70d
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
2 changed files with 23 additions and 9 deletions

View File

@ -109,7 +109,7 @@
(fx/defn intro-step-forward
{:events [:intro-wizard/step-forward-pressed]}
[{:keys [db] :as cofx} {:keys [skip?] :as opts}]
(let [{:keys [step first-time-setup? selected-storage-type]} (:intro-wizard db)]
(let [{:keys [step first-time-setup? selected-storage-type processing?]} (:intro-wizard db)]
(cond (confirm-failure? db)
(on-confirm-failure cofx)
@ -128,15 +128,19 @@
(store-key-code cofx)
(and (= step :confirm-code)
(not (:multiaccounts/login db)))
(create-multiaccount cofx)
(not (:multiaccounts/login db))
(not processing?))
(fx/merge cofx
{:db (assoc-in db [:intro-wizard :processing?] true)}
create-multiaccount)
(and (= step :select-key-storage)
(= :advanced selected-storage-type))
{:dispatch [:keycard/start-onboarding-flow]}
:else {:db (assoc-in db [:intro-wizard :step]
(inc-step step))})))
:else {:db (update db :intro-wizard
assoc :processing? false
:step (inc-step step))})))
(defn prepare-subaccounts-data
[multiaccount]

View File

@ -204,8 +204,16 @@
(defn create-code [{:keys [confirm-failure?] :as wizard-state} view-width]
[password-container confirm-failure? view-width])
(defn confirm-code [{:keys [confirm-failure?] :as wizard-state} view-width]
[password-container confirm-failure? view-width])
(defn confirm-code [{:keys [confirm-failure? processing?] :as wizard-state} view-width]
(if processing?
[react/view {:style {:justify-content :center
:align-items :center}}
[react/activity-indicator {:size :large
:animating true}]
[react/text {:style {:color colors/gray
:margin-top 8}}
(i18n/label :t/processing)]]
[password-container confirm-failure? view-width]))
(defn enable-fingerprint []
[vector-icons/icon :main-icons/fingerprint
@ -218,7 +226,8 @@
:justify-content :center}
:width 66 :height 64}])
(defn bottom-bar [{:keys [step generating-keys? weak-password? encrypt-with-password?] :as wizard-state}]
(defn bottom-bar [{:keys [step generating-keys? weak-password? encrypt-with-password?
processing?] :as wizard-state}]
[react/view {:style {:margin-bottom (if (or (#{:choose-key :select-key-storage} step)
(and (#{:create-code :confirm-code} step)
encrypt-with-password?))
@ -248,7 +257,8 @@
[react/view {:style styles/bottom-arrow}
[components.common/bottom-button {:on-press #(re-frame/dispatch
[:intro-wizard/step-forward-pressed])
:disabled? (and (= step :create-code) weak-password?)
:disabled? (or processing?
(and (= step :create-code) weak-password?))
:forward? true}]])
(when (#{:enable-fingerprint :enable-notifications} step)
[components.common/button {:button-style (assoc styles/bottom-button :margin-top 20)