Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-boarding: re add bio-metric screen to syncing flow #21890

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/status_im/contexts/centralized_metrics/tracking.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
(contains? view-ids-to-track view-id)
(conj (navigation-event (name view-id)))

(= :screen/onboarding.syncing-results view-id)
(#{:screen/onboarding.preparing-status :screen/onboarding.syncing-biometric} view-id)
(conj (key-value-event "onboarding-completed"))

(= :screen/keycard.migrate.success view-id)
Expand Down
9 changes: 3 additions & 6 deletions src/status_im/contexts/onboarding/enable_biometrics/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[status-im.common.biometric.utils :as biometric]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.enable-biometrics.style :as style]
[status-im.navigation.state :as state]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand All @@ -25,7 +24,7 @@
bio-type-label (biometric/get-label-by-type supported-biometric-type)
profile-color (or (:color (rf/sub [:onboarding/profile]))
(rf/sub [:profile/customization-color]))
syncing-results? (= :screen/onboarding.syncing-results @state/root-id)
syncing? (= (rf/sub [:view-id]) :screen/onboarding.syncing-biometric)
biometric-type (rf/sub [:biometrics/supported-type])]
[rn/view {:style (style/buttons insets)}
[quo/button
Expand All @@ -39,10 +38,8 @@
{:accessibility-label :maybe-later-button
:background :blur
:type :grey
:on-press #(rf/dispatch (if syncing-results?
[:navigate-to-within-stack
[:screen/onboarding.enable-notifications
:screen/onboarding.enable-biometrics]]
:on-press #(rf/dispatch (if syncing?
[:onboarding/finish-onboarding false]
[:onboarding/create-account-and-login]))
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))
Expand Down
16 changes: 1 addition & 15 deletions src/status_im/contexts/onboarding/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
(fn [{:keys [db]}]
{:db (dissoc db :onboarding/navigated-to-enter-seed-phrase-from-screen)}))

(rf/reg-event-fx :onboarding/navigate-to-enable-notifications-from-syncing
(fn [{:keys [db]}]
{:db (dissoc db :onboarding/profile)
:dispatch [:navigate-to-within-stack
[:screen/onboarding.enable-notifications :screen/onboarding.enable-biometrics]]}))

(rf/reg-event-fx :onboarding/navigate-to-enable-notifications
(fn [{:keys [db]}]
{:dispatch [:navigate-to-within-stack
Expand Down Expand Up @@ -113,14 +107,6 @@
[:navigate-to-within-stack [:screen/onboarding.enable-biometrics from-screen]]
[:onboarding/create-account-and-login])]]})))

(rf/reg-event-fx
:onboarding/navigate-to-enable-biometrics
(fn [{:keys [db]}]
(let [supported-type (get-in db [:biometrics :supported-type])]
{:dispatch (if supported-type
[:open-modal :screen/onboarding.enable-biometrics]
[:open-modal :screen/onboarding.enable-notifications])})))

(rf/reg-event-fx
:onboarding/seed-phrase-validated
(fn [{:keys [db]} [seed-phrase key-uid]]
Expand Down Expand Up @@ -200,7 +186,7 @@
(rf/dispatch [:onboarding/set-auth-method auth-method])
(when syncing?
(rf/dispatch
[:onboarding/navigate-to-enable-notifications-from-syncing])))
[:onboarding/finish-onboarding false])))
:on-error #(log/error "failed to save biometrics"
{:key-uid key-uid
:error %})}])]})))
37 changes: 19 additions & 18 deletions src/status_im/contexts/onboarding/syncing/progress/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,25 @@

(defn try-again-button
[profile-color logged-in?]
[quo/bottom-actions
{:actions (if logged-in? :one-action :two-vertical-actions)
:blur? true
:container-style {:height (when-not logged-in? 116)}
:button-two-label (i18n/label :t/use-recovery-phrase)
:button-two-props {:type :primary
:accessibility-label :try-seed-phrase-button
:customization-color profile-color
:size 40
:on-press navigate-to-enter-seed-phrase}
:button-one-label
(i18n/label :t/try-again)
:button-one-props
{:type (if logged-in? :primary :grey)
:accessibility-label :try-again-later-button
:customization-color profile-color
:size 40
:on-press #(try-again logged-in?)}}])
(let [two-vertical-actions-height 116]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New change - other are indentations - leftover from #21884 (comment)

[quo/bottom-actions
{:actions (if logged-in? :one-action :two-vertical-actions)
:blur? true
:container-style {:height (when-not logged-in? two-vertical-actions-height)}
:button-two-label (i18n/label :t/use-recovery-phrase)
:button-two-props {:type :primary
:accessibility-label :try-seed-phrase-button
:customization-color profile-color
:size 40
:on-press navigate-to-enter-seed-phrase}
:button-one-label
(i18n/label :t/try-again)
:button-one-props
{:type (if logged-in? :primary :grey)
:accessibility-label :try-again-later-button
:customization-color profile-color
:size 40
:on-press #(try-again logged-in?)}}]))

(defn- illustration
[pairing-progress?]
Expand Down
43 changes: 0 additions & 43 deletions src/status_im/contexts/onboarding/syncing/results/style.cljs

This file was deleted.

84 changes: 0 additions & 84 deletions src/status_im/contexts/onboarding/syncing/results/view.cljs

This file was deleted.

31 changes: 16 additions & 15 deletions src/status_im/contexts/profile/login/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
;; login phase 1: we want to load and show chats faster, so we split login into 2 phases
(rf/reg-event-fx :profile.login/login-existing-profile
(fn [{:keys [db]} [settings-data account]]
(let [settings (data-store.settings/rpc->settings settings-data)
profile-overview (profile.rpc/rpc->profiles-overview account)
log-level (or (:log-level settings) config/log-level)
pairing-completed? (= (get-in db [:syncing :pairing-status]) :completed)
new-db (-> db
(assoc :profile/profile
(merge profile-overview
settings
{:log-level log-level}))
(assoc-in [:activity-center :loading?] true)
(dissoc :centralized-metrics/onboarding-enabled?))
keycard? (get-in new-db [:profile/profile :keycard-pairing])]
(let [settings (data-store.settings/rpc->settings settings-data)
profile-overview (profile.rpc/rpc->profiles-overview account)
log-level (or (:log-level settings) config/log-level)
pairing-completed? (= (get-in db [:syncing :pairing-status]) :completed)
biometric-supported-type (get-in db [:biometrics :supported-type])
new-db (-> db
(assoc :profile/profile
(merge profile-overview
settings
{:log-level log-level}))
(assoc-in [:activity-center :loading?] true)
(dissoc :centralized-metrics/onboarding-enabled?))
keycard? (get-in new-db [:profile/profile :keycard-pairing])]
{:db (cond-> new-db
pairing-completed? (dissoc :syncing))
:fx (into [[:json-rpc/call
Expand Down Expand Up @@ -81,10 +82,10 @@
(when keycard?
[:dispatch [:centralized-metrics/track :metric/keycard-login]])]
(cond
pairing-completed?
[[:dispatch [:onboarding/finish-onboarding false]]]
(and pairing-completed? biometric-supported-type)
[[:dispatch [:update-theme-and-init-root :screen/onboarding.syncing-biometric]]]

(get db :onboarding/new-account?)
(or pairing-completed? (get db :onboarding/new-account?))
[[:dispatch [:onboarding/finalize-setup]]
[:dispatch [:onboarding/finish-onboarding false]]]

Expand Down
7 changes: 4 additions & 3 deletions src/status_im/navigation/roots.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
:id :screen/profile.profiles
:options (options/dark-root-options)}}]}}}

:screen/onboarding.syncing-results
{:root {:stack {:children [{:component {:name :screen/onboarding.syncing-results
:id :screen/onboarding.syncing-results
:screen/onboarding.syncing-biometric
{:root {:stack {:id :screen/onboarding.enable-biometrics
:children [{:component {:name :screen/onboarding.enable-biometrics
:id :screen/onboarding.enable-biometrics
:options (options/dark-root-options)}}]}}}})

(defn old-roots
Expand Down
11 changes: 1 addition & 10 deletions src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
[status-im.contexts.onboarding.share-usage.view :as onboarding.share-usage]
[status-im.contexts.onboarding.sign-in.view :as sign-in]
[status-im.contexts.onboarding.syncing.progress.view :as syncing-devices]
[status-im.contexts.onboarding.syncing.results.view :as syncing-results]
[status-im.contexts.preview.feature-flags.view :as feature-flags]
[status-im.contexts.preview.quo.component-preview.view :as component-preview]
[status-im.contexts.preview.quo.main :as quo.preview]
Expand Down Expand Up @@ -855,13 +854,6 @@
:popGesture false}
:component syncing-devices/view-onboarding})

(def onboarding-syncing-results
{:name :screen/onboarding.syncing-results
:metrics {:track? true
:alias-id :onboarding.syncing-completed}
:options {:theme :dark}
:component syncing-results/view})

(def onboarding-screens
[onboarding-intro
onboarding-create-profile
Expand All @@ -875,8 +867,7 @@
onboarding-sign-in-intro
onboarding-sign-in
onboarding-syncing-progress
onboarding-syncing-progress-intro
onboarding-syncing-results])
onboarding-syncing-progress-intro])

(def keycard-screens
[{:name :screen/keycard.check
Expand Down