Skip to content

Commit

Permalink
fix Error when creating an account on e2e build (#21496)
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull authored and ulisesmac committed Oct 30, 2024
1 parent 4aef762 commit bd84143
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
28 changes: 25 additions & 3 deletions src/status_im/contexts/onboarding/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@
(fn [_ [error]]
{:dispatch [:biometric/show-message (ex-cause error)]}))

;; Navigate to next screen once onboarding animation and account creation both are complete
;; Note: If account creation fails, user will get stuck on loading screen
;; TODO: Show error screen in case account creation/restoration fails
(rf/reg-event-fx :onboarding/account-creation-complete
(fn [{:keys [db]} [opts]]
(let [loading-animation-complete? (or (:loading-animation-complete? opts)
(:onboarding/loading-animation-complete? db))
loading-screen (or (:loading-screen opts) (:onboarding/loading-screen db))
login-signal-received? (or (:login-signal-received? opts)
(:onboarding/login-signal-received? db))]
(if (and loading-animation-complete? login-signal-received?)
{:db (-> db
(dissoc :onboarding/loading-screen)
(dissoc :onboarding/loading-animation-complete?)
(dissoc :onboarding/login-signal-received?))
:fx [[:dispatch
[:navigate-to-within-stack [:screen/onboarding.enable-notifications loading-screen]]]]}
{:db (-> db
(assoc :onboarding/loading-screen loading-screen)
(assoc :onboarding/loading-animation-complete? loading-animation-complete?)
(assoc :onboarding/login-signal-received? login-signal-received?))}))))

(rf/defn create-account-and-login
{:events [:onboarding/create-account-and-login]}
[{:keys [db] :as cofx}]
Expand All @@ -88,9 +110,9 @@
(when-not syncing-account-recovered?
[:dispatch [:syncing/clear-syncing-installation-id]])]
:dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
:dispatch [:navigate-to-within-stack
[:screen/onboarding.enable-notifications
loading-screen]]}]
:dispatch [:onboarding/account-creation-complete
{:loading-animation-complete? true
:loading-screen loading-screen}]}]
:db (-> db
(dissoc :profile/login)
(dissoc :auth-method)
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/contexts/profile/login/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
[[:dispatch [:update-theme-and-init-root :screen/onboarding.syncing-results]]]

(get db :onboarding/new-account?)
[[:dispatch [:onboarding/finalize-setup]]]
[[:dispatch [:onboarding/finalize-setup]]
[:dispatch [:onboarding/account-creation-complete {:login-signal-received? true}]]]

:else
[[:dispatch [:update-theme-and-init-root :shell-stack]]
Expand Down

0 comments on commit bd84143

Please sign in to comment.