diff --git a/src/status_im/contexts/centralized_metrics/tracking.cljs b/src/status_im/contexts/centralized_metrics/tracking.cljs index ac0d9102c4..6606235fca 100644 --- a/src/status_im/contexts/centralized_metrics/tracking.cljs +++ b/src/status_im/contexts/centralized_metrics/tracking.cljs @@ -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) diff --git a/src/status_im/contexts/onboarding/enable_biometrics/view.cljs b/src/status_im/contexts/onboarding/enable_biometrics/view.cljs index cc59f2d1b2..228aa3a537 100644 --- a/src/status_im/contexts/onboarding/enable_biometrics/view.cljs +++ b/src/status_im/contexts/onboarding/enable_biometrics/view.cljs @@ -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])) @@ -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 @@ -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)]])) diff --git a/src/status_im/contexts/onboarding/events.cljs b/src/status_im/contexts/onboarding/events.cljs index 3bce2325b3..72f0006fa0 100644 --- a/src/status_im/contexts/onboarding/events.cljs +++ b/src/status_im/contexts/onboarding/events.cljs @@ -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 @@ -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]] @@ -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 %})}])]}))) diff --git a/src/status_im/contexts/onboarding/syncing/progress/view.cljs b/src/status_im/contexts/onboarding/syncing/progress/view.cljs index dc4916929d..7052ca305e 100644 --- a/src/status_im/contexts/onboarding/syncing/progress/view.cljs +++ b/src/status_im/contexts/onboarding/syncing/progress/view.cljs @@ -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] + [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?] diff --git a/src/status_im/contexts/onboarding/syncing/results/style.cljs b/src/status_im/contexts/onboarding/syncing/results/style.cljs deleted file mode 100644 index 7b65dc0ce0..0000000000 --- a/src/status_im/contexts/onboarding/syncing/results/style.cljs +++ /dev/null @@ -1,43 +0,0 @@ -(ns status-im.contexts.onboarding.syncing.results.style - (:require - [quo.foundations.colors :as colors] - [react-native.reanimated :as reanimated])) - -(def absolute-fill - {:position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0}) - -(defn page-container - [top] - {:flex 1 - :position :absolute - :top 0 - :bottom 0 - :left 0 - :right 0 - :padding-top top - :padding-bottom 20 - :background-color colors/neutral-80-opa-80-blur}) - -(defn content - [translate-x] - (reanimated/apply-animations-to-style - {:transform [{:translate-x translate-x}]} - {:margin-top 56 - :margin-bottom 26 - :flex 1})) - -(def current-device - {:margin-bottom 19}) - -(def device-list - {:flex 1 - :margin-top 12 - :padding-horizontal 20}) - -(def continue-button - {:margin-top 20 - :padding-horizontal 20}) diff --git a/src/status_im/contexts/onboarding/syncing/results/view.cljs b/src/status_im/contexts/onboarding/syncing/results/view.cljs deleted file mode 100644 index 125c17b61e..0000000000 --- a/src/status_im/contexts/onboarding/syncing/results/view.cljs +++ /dev/null @@ -1,84 +0,0 @@ -(ns status-im.contexts.onboarding.syncing.results.view - (:require - [quo.core :as quo] - [quo.foundations.colors :as colors] - [react-native.core :as rn] - [react-native.reanimated :as reanimated] - [react-native.safe-area :as safe-area] - [status-im.constants :as constants] - [status-im.contexts.onboarding.common.background.view :as background] - [status-im.contexts.onboarding.syncing.results.style :as style] - [status-im.contexts.syncing.device.view :as device] - [utils.i18n :as i18n] - [utils.re-frame :as rf])) - -(defn page-title - [] - [quo/text-combinations - {:container-style {:margin-horizontal 20} - :title (i18n/label :t/sync-devices-complete-title) - :title-accessibility-label :sync-devices-title - :description (i18n/label :t/sync-devices-complete-sub-title) - :description-accessibility-label :sync-devices-complete-sub-title}]) - -(defn current-device - [installation] - [rn/view {:style style/current-device} - [device/view - (merge installation - {:this-device? true})]]) - -(defn devices-list - [] - (let [installations (rf/sub [:pairing/enabled-installations]) - this-device (first installations) - other-devices (rest installations)] - [rn/view {:style style/device-list} - [current-device this-device] - [quo/text - {:accessibility-label :synced-with-sub-title - :weight :regular - :size :paragraph-2 - :style {:color colors/white-opa-40}} - (i18n/label :t/synced-with)] - [rn/flat-list - {:data other-devices - :shows-vertical-scroll-indicator false - :key-fn :installation-id - :render-fn device/view}]])) - -(defn continue-button - [on-press] - (let [profile-color (rf/sub [:profile/customization-color])] - [quo/button - {:on-press (fn [] - (when on-press - (on-press)) - (rf/dispatch [:onboarding/navigate-to-enable-biometrics])) - :accessibility-label :continue-button - :customization-color profile-color - :container-style style/continue-button} - (i18n/label :t/continue)])) - -(defn- f-view - [] - (let [top (safe-area/get-top) - translate-x (reanimated/use-shared-value 0) - window-width (:width (rn/get-window))] - [rn/view {:style (style/page-container top)} - [rn/view {:style style/absolute-fill} - [background/view true]] - [reanimated/view - {:style (style/content translate-x)} - [page-title] - [devices-list] - [continue-button - #(reanimated/animate-shared-value-with-delay translate-x - (- window-width) - constants/onboarding-modal-animation-duration - :linear - 200)]]])) - -(defn view - [] - [:f> f-view]) diff --git a/src/status_im/contexts/profile/login/events.cljs b/src/status_im/contexts/profile/login/events.cljs index 189c77deb9..8d7e21968d 100644 --- a/src/status_im/contexts/profile/login/events.cljs +++ b/src/status_im/contexts/profile/login/events.cljs @@ -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 @@ -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]]] diff --git a/src/status_im/navigation/roots.cljs b/src/status_im/navigation/roots.cljs index 33e49ca36f..a1a46de948 100644 --- a/src/status_im/navigation/roots.cljs +++ b/src/status_im/navigation/roots.cljs @@ -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 diff --git a/src/status_im/navigation/screens.cljs b/src/status_im/navigation/screens.cljs index 7e6fd15aac..ecbc2c7870 100644 --- a/src/status_im/navigation/screens.cljs +++ b/src/status_im/navigation/screens.cljs @@ -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] @@ -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 @@ -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