Add processing indicator when creating multiaccount
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
parent
564090d7e6
commit
4c545cb70d
|
@ -109,7 +109,7 @@
|
||||||
(fx/defn intro-step-forward
|
(fx/defn intro-step-forward
|
||||||
{:events [:intro-wizard/step-forward-pressed]}
|
{:events [:intro-wizard/step-forward-pressed]}
|
||||||
[{:keys [db] :as cofx} {:keys [skip?] :as opts}]
|
[{: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)
|
(cond (confirm-failure? db)
|
||||||
(on-confirm-failure cofx)
|
(on-confirm-failure cofx)
|
||||||
|
|
||||||
|
@ -128,15 +128,19 @@
|
||||||
(store-key-code cofx)
|
(store-key-code cofx)
|
||||||
|
|
||||||
(and (= step :confirm-code)
|
(and (= step :confirm-code)
|
||||||
(not (:multiaccounts/login db)))
|
(not (:multiaccounts/login db))
|
||||||
(create-multiaccount cofx)
|
(not processing?))
|
||||||
|
(fx/merge cofx
|
||||||
|
{:db (assoc-in db [:intro-wizard :processing?] true)}
|
||||||
|
create-multiaccount)
|
||||||
|
|
||||||
(and (= step :select-key-storage)
|
(and (= step :select-key-storage)
|
||||||
(= :advanced selected-storage-type))
|
(= :advanced selected-storage-type))
|
||||||
{:dispatch [:keycard/start-onboarding-flow]}
|
{:dispatch [:keycard/start-onboarding-flow]}
|
||||||
|
|
||||||
:else {:db (assoc-in db [:intro-wizard :step]
|
:else {:db (update db :intro-wizard
|
||||||
(inc-step step))})))
|
assoc :processing? false
|
||||||
|
:step (inc-step step))})))
|
||||||
|
|
||||||
(defn prepare-subaccounts-data
|
(defn prepare-subaccounts-data
|
||||||
[multiaccount]
|
[multiaccount]
|
||||||
|
|
|
@ -204,8 +204,16 @@
|
||||||
(defn create-code [{:keys [confirm-failure?] :as wizard-state} view-width]
|
(defn create-code [{:keys [confirm-failure?] :as wizard-state} view-width]
|
||||||
[password-container confirm-failure? view-width])
|
[password-container confirm-failure? view-width])
|
||||||
|
|
||||||
(defn confirm-code [{:keys [confirm-failure?] :as wizard-state} view-width]
|
(defn confirm-code [{:keys [confirm-failure? processing?] :as wizard-state} view-width]
|
||||||
[password-container confirm-failure? 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 []
|
(defn enable-fingerprint []
|
||||||
[vector-icons/icon :main-icons/fingerprint
|
[vector-icons/icon :main-icons/fingerprint
|
||||||
|
@ -218,7 +226,8 @@
|
||||||
:justify-content :center}
|
:justify-content :center}
|
||||||
:width 66 :height 64}])
|
: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)
|
[react/view {:style {:margin-bottom (if (or (#{:choose-key :select-key-storage} step)
|
||||||
(and (#{:create-code :confirm-code} step)
|
(and (#{:create-code :confirm-code} step)
|
||||||
encrypt-with-password?))
|
encrypt-with-password?))
|
||||||
|
@ -248,7 +257,8 @@
|
||||||
[react/view {:style styles/bottom-arrow}
|
[react/view {:style styles/bottom-arrow}
|
||||||
[components.common/bottom-button {:on-press #(re-frame/dispatch
|
[components.common/bottom-button {:on-press #(re-frame/dispatch
|
||||||
[:intro-wizard/step-forward-pressed])
|
[:intro-wizard/step-forward-pressed])
|
||||||
:disabled? (and (= step :create-code) weak-password?)
|
:disabled? (or processing?
|
||||||
|
(and (= step :create-code) weak-password?))
|
||||||
:forward? true}]])
|
:forward? true}]])
|
||||||
(when (#{:enable-fingerprint :enable-notifications} step)
|
(when (#{:enable-fingerprint :enable-notifications} step)
|
||||||
[components.common/button {:button-style (assoc styles/bottom-button :margin-top 20)
|
[components.common/button {:button-style (assoc styles/bottom-button :margin-top 20)
|
||||||
|
|
Loading…
Reference in New Issue