Remove onboarding generating keys screen (#21608)

This commit is contained in:
Parvesh Monu 2024-11-13 00:46:59 +05:30 committed by GitHub
parent 76d6825dd5
commit 0f00f8439f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 21 additions and 183 deletions

View File

@ -450,7 +450,6 @@
(def ^:const biometrics-type-touch-id :TouchID)
(def ^:const biometrics-type-face-id :FaceID)
(def ^:const onboarding-generating-keys-animation-duration-ms 7000)
(def ^:const onboarding-generating-keys-navigation-retry-ms 3000)
(def ^:const image-description-in-lightbox? false)

View File

@ -67,7 +67,7 @@
(fn []
(reanimated/set-shared-value @paused? (not= view-id :screen/onboarding.intro))
(fn []
(when (= view-id :screen/onboarding.generating-keys)
(when (= view-id :screen/onboarding.preparing-status)
(carousel.animation/cleanup-animation progress paused?))))
[view-id])

View File

@ -67,28 +67,6 @@
(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}]
@ -96,27 +74,20 @@
(:onboarding/profile db)
syncing-account-recovered? (and (seq (:syncing/key-uid db))
(= (:syncing/key-uid db)
(get-in db [:onboarding/profile :key-uid])))
loading-screen (if syncing-account-recovered?
:screen/onboarding.preparing-status
:screen/onboarding.generating-keys)]
(get-in db [:onboarding/profile :key-uid])))]
(rf/merge cofx
{:fx [[:dispatch
[:navigate-to-within-stack
[loading-screen
(get db
:onboarding/navigated-to-enter-seed-phrase-from-screen
:screen/onboarding.new-to-status)]]]
(when-not syncing-account-recovered?
[:dispatch [:syncing/clear-syncing-installation-id]])]
:dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
:dispatch [:onboarding/account-creation-complete
{:loading-animation-complete? true
:loading-screen loading-screen}]}]
:db (-> db
(dissoc :profile/login)
(dissoc :auth-method)
(assoc :onboarding/new-account? true))}
{:fx [[:dispatch
[:navigate-to-within-stack
[:screen/onboarding.preparing-status
(get db
:onboarding/navigated-to-enter-seed-phrase-from-screen
:screen/onboarding.new-to-status)]]]
(when-not syncing-account-recovered?
[:dispatch [:syncing/clear-syncing-installation-id]])]
:db (-> db
(dissoc :profile/login)
(dissoc :auth-method)
(assoc :onboarding/new-account? true))}
(if seed-phrase
(profile.recover/recover-profile-and-login profile)
(profile.create/create-profile-and-login profile)))))

View File

@ -1,17 +0,0 @@
(ns status-im.contexts.onboarding.generating-keys.style)
(defn page-container
[insets]
{:flex 1
:padding-top (:top insets)})
(defn page-illustration
[width]
{:flex 1
:width width})
(def title-style
{:position :absolute
:left 0
:right 0
:top 0})

View File

@ -1,105 +0,0 @@
(ns status-im.contexts.onboarding.generating-keys.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.generating-keys.style :as style]
[utils.i18n :as i18n]))
(def first-title-display-time 3000)
(def second-title-start-time 3500)
(def second-title-display-time 1000)
(def third-title-start-time 5500)
(def transition-duration-time 500)
(defn generate-keys-title
[]
[quo/text-combinations
{:container-style {:margin-horizontal 20
:margin-vertical 12}
:title (i18n/label :t/generating-keys)}])
(defn saving-keys-title
[]
[quo/text-combinations
{:container-style {:margin-horizontal 20
:margin-vertical 12}
:title (i18n/label :t/saving-keys-to-device)}])
(defn keys-saved-title
[]
[quo/text-combinations
{:container-style {:margin-horizontal 20
:margin-vertical 12}
:title (i18n/label :t/keys-saved)}])
(defn sequence-animation
[generate-keys-opacity saving-keys-opacity keys-saved-opacity]
(reanimated/set-shared-value generate-keys-opacity
(reanimated/with-delay
first-title-display-time
(reanimated/with-timing 0
(js-obj "duration" transition-duration-time
"easing" (:linear
reanimated/easings)))))
(reanimated/set-shared-value
saving-keys-opacity
(reanimated/with-sequence
(reanimated/with-delay second-title-start-time
(reanimated/with-timing 1
(js-obj "duration" transition-duration-time
"easing" (:linear reanimated/easings))))
(reanimated/with-delay second-title-display-time
(reanimated/with-timing 0
(js-obj "duration" transition-duration-time
"easing" (:linear reanimated/easings))))))
(reanimated/set-shared-value keys-saved-opacity
(reanimated/with-delay
third-title-start-time
(reanimated/with-timing 1
(js-obj "duration" transition-duration-time
"easing" (:linear
reanimated/easings))))))
(defn title
[]
(let [generate-keys-opacity (reanimated/use-shared-value 1)
saving-keys-opacity (reanimated/use-shared-value 0)
keys-saved-opacity (reanimated/use-shared-value 0)]
(sequence-animation generate-keys-opacity saving-keys-opacity keys-saved-opacity)
[rn/view
{:style {:margin-top 56
:height 56}}
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity generate-keys-opacity}
style/title-style)}
[generate-keys-title]]
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity saving-keys-opacity}
style/title-style)}
[saving-keys-title]]
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity keys-saved-opacity}
style/title-style)}
[keys-saved-title]]]))
(defn content
[]
(let [width (:width (rn/get-window))]
[rn/image
{:resize-mode :contain
:style (style/page-illustration width)
:source (resources/get-image :generate-keys1)}]))
(defn view
[]
(let [insets (safe-area/get-insets)]
[rn/view {:style (style/page-container insets)}
[:<>
[title]
[content]]]))

View File

@ -4,7 +4,7 @@
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[status-im.common.resources :as resources]
[status-im.contexts.onboarding.generating-keys.style :as style]
[status-im.contexts.onboarding.preparing-status.style :as style]
[utils.i18n :as i18n]))
(defn title
@ -16,7 +16,7 @@
[quo/text-combinations
{:container-style {:margin-horizontal 20
:margin-vertical 12}
:title (i18n/label :t/preparing-app-for-you)
:title (i18n/label :t/preparing-status-for-you)
:description (i18n/label :t/hang-in-there)}]])
(defn content

View File

@ -85,7 +85,10 @@
(get db :onboarding/new-account?)
[[:dispatch [:onboarding/finalize-setup]]
[:dispatch [:onboarding/account-creation-complete {:login-signal-received? true}]]]
[:dispatch
[:navigate-to-within-stack
[:screen/onboarding.enable-notifications
:screen/onboarding.preparing-status]]]]
:else
[[:dispatch [:update-theme-and-init-root :shell-stack]]

View File

@ -45,7 +45,6 @@
[status-im.contexts.onboarding.create-profile.view :as create-profile]
[status-im.contexts.onboarding.enable-biometrics.view :as enable-biometrics]
[status-im.contexts.onboarding.enable-notifications.view :as enable-notifications]
[status-im.contexts.onboarding.generating-keys.view :as generating-keys]
[status-im.contexts.onboarding.identifiers.view :as identifiers]
[status-im.contexts.onboarding.intro.view :as intro]
[status-im.contexts.onboarding.preparing-status.view :as preparing-status]
@ -761,17 +760,6 @@
:popStackOnPress false}}
:component enable-biometrics/view})
(def onboarding-generating-keys
{:name :screen/onboarding.generating-keys
:metrics {:track? true}
:options {:theme :dark
:layout options/onboarding-transparent-layout
:animations transitions/push-animations-for-transparent-background
:popGesture false
:hardwareBackButton {:dismissModalOnPress false
:popStackOnPress false}}
:component generating-keys/view})
(def onboarding-preparing-status
{:name :screen/onboarding.preparing-status
:metrics {:track? true}
@ -872,7 +860,6 @@
onboarding-create-profile
onboarding-create-profile-password
onboarding-enable-biometrics
onboarding-generating-keys
onboarding-preparing-status
onboarding-entering-seed-phrase
onboarding-enable-notifications

View File

@ -1975,7 +1975,7 @@
"powered-by-paraswap": "Powered by Paraswap",
"preference": "Preference",
"preferred-by-receiver": "Preferred by receiver",
"preparing-app-for-you": "Preparing app for you...",
"preparing-status-for-you": "Preparing Status for you...",
"press": "Press",
"preview-privacy": "Preview privacy mode",
"previewing-may-share-metadata": "Previewing links from these websites may share your metadata with their owners",