|
71 | 71 | {:events [:onboarding/create-account-and-login]}
|
72 | 72 | [{:keys [db] :as cofx}]
|
73 | 73 | (let [{:keys [display-name seed-phrase password image-path color] :as profile}
|
74 |
| - (:onboarding/profile db)] |
| 74 | + (:onboarding/profile db) |
| 75 | + loading-screen (if (seq (:syncing/key-uid db)) |
| 76 | + :screen/onboarding.preparing-status |
| 77 | + :screen/onboarding.generating-keys)] |
75 | 78 | (rf/merge cofx
|
76 | 79 | {:dispatch [:navigate-to-within-stack
|
77 |
| - [:screen/onboarding.generating-keys |
| 80 | + [loading-screen |
78 | 81 | (get db
|
79 | 82 | :onboarding/navigated-to-enter-seed-phrase-from-screen
|
80 | 83 | :screen/onboarding.new-to-status)]]
|
81 | 84 | :dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
|
82 | 85 | :dispatch [:navigate-to-within-stack
|
83 | 86 | [:screen/onboarding.enable-notifications
|
84 |
| - :screen/onboarding.generating-keys]]}] |
| 87 | + loading-screen]]}] |
85 | 88 | :db (-> db
|
86 | 89 | (dissoc :profile/login)
|
87 | 90 | (dissoc :auth-method)
|
|
134 | 137 | (rf/defn seed-phrase-validated
|
135 | 138 | {:events [:onboarding/seed-phrase-validated]}
|
136 | 139 | [{:keys [db]} seed-phrase key-uid]
|
137 |
| - (if (contains? (:profile/profiles-overview db) key-uid) |
138 |
| - {:effects.utils/show-confirmation |
139 |
| - {:title (i18n/label :t/multiaccount-exists-title) |
140 |
| - :content (i18n/label :t/multiaccount-exists-content) |
141 |
| - :confirm-button-text (i18n/label :t/unlock) |
142 |
| - :on-accept (fn [] |
143 |
| - (re-frame/dispatch [:pop-to-root :screen/profile.profiles]) |
144 |
| - (re-frame/dispatch |
145 |
| - [:profile/profile-selected key-uid])) |
146 |
| - :on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}} |
147 |
| - {:db (assoc-in db [:onboarding/profile :seed-phrase] seed-phrase) |
148 |
| - :dispatch [:navigate-to-within-stack |
149 |
| - [:screen/onboarding.create-profile |
150 |
| - (get db |
151 |
| - :onboarding/navigated-to-enter-seed-phrase-from-screen |
152 |
| - :screen/onboarding.new-to-status)]]})) |
| 140 | + (let [syncing-account-recovered? (and (seq (:syncing/key-uid db)) |
| 141 | + (= (:syncing/key-uid db) key-uid)) |
| 142 | + next-screen (if syncing-account-recovered? |
| 143 | + :screen/onboarding.create-profile-password |
| 144 | + :screen/onboarding.create-profile)] |
| 145 | + (if (contains? (:profile/profiles-overview db) key-uid) |
| 146 | + {:effects.utils/show-confirmation |
| 147 | + {:title (i18n/label :t/multiaccount-exists-title) |
| 148 | + :content (i18n/label :t/multiaccount-exists-content) |
| 149 | + :confirm-button-text (i18n/label :t/unlock) |
| 150 | + :on-accept (fn [] |
| 151 | + (re-frame/dispatch [:pop-to-root :screen/profile.profiles]) |
| 152 | + (re-frame/dispatch |
| 153 | + [:profile/profile-selected key-uid])) |
| 154 | + :on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}} |
| 155 | + {:db (-> db |
| 156 | + (assoc-in [:onboarding/profile :seed-phrase] seed-phrase) |
| 157 | + (assoc-in [:onboarding/profile :color] constants/profile-default-color)) |
| 158 | + :fx [[:dispatch |
| 159 | + [:navigate-to-within-stack |
| 160 | + [next-screen |
| 161 | + (get db |
| 162 | + :onboarding/navigated-to-enter-seed-phrase-from-screen |
| 163 | + :screen/onboarding.new-to-status)]]] |
| 164 | + (when-not syncing-account-recovered? |
| 165 | + [:dispatch [:syncing/clear-syncing-data]])]}))) |
153 | 166 |
|
154 | 167 | (rf/defn navigate-to-create-profile
|
155 | 168 | {:events [:onboarding/navigate-to-create-profile]}
|
|
0 commit comments