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

rename onboarding 2 #18060

Merged
merged 1 commit into from
Dec 4, 2023
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/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

(rf/defn on-return-from-background
[{:keys [db now] :as cofx}]
(let [new-account? (get db :onboarding-2/new-account?)
(let [new-account? (get db :onboarding/new-account?)
app-in-background-since (get db :app-in-background-since)
signed-up? (get-in db [:profile/profile :signed-up?])
requires-bio-auth (and
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/transport/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{:events [::messenger-started]}
[{:keys [db] :as cofx} {:keys [mailservers] :as response}]
(log/info "Messenger started")
(let [new-account? (get db :onboarding-2/new-account?)]
(let [new-account? (get db :onboarding/new-account?)]
(rf/merge cofx
{:db (-> db
(assoc :messenger/started? true)
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/ui/screens/profile/user/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
key-uid]
:as profile}
@(re-frame/subscribe [:profile/profile-with-image])
customization-color (or (:color @(re-frame/subscribe [:onboarding-2/profile]))
customization-color (or (:color @(re-frame/subscribe [:onboarding/profile]))
@(re-frame/subscribe [:profile/customization-color key-uid]))
on-share #(re-frame/dispatch [:show-popover
{:view :share-chat-key
Expand Down
4 changes: 2 additions & 2 deletions src/status_im2/contexts/onboarding/create_password/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
same-password-length? #(and (seq @password)
(= (count @password) (count @repeat-password)))]
(fn []
(let [{user-color :color} (rf/sub [:onboarding-2/profile])
(let [{user-color :color} (rf/sub [:onboarding/profile])
{:keys [long-enough?]
:as validations} (password-validations @password)
password-strength (calc-password-strength validations)
Expand Down Expand Up @@ -177,7 +177,7 @@
{:disabled? (not meet-requirements?)
:customization-color user-color
:on-press #(rf/dispatch
[:onboarding-2/password-set
[:onboarding/password-set
(security/mask-data @password)])}
(i18n/label :t/password-creation-confirm)]]]]))))

Expand Down
4 changes: 2 additions & 2 deletions src/status_im2/contexts/onboarding/create_profile/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
:type :primary
:customization-color @custom-color
:on-press (fn []
(rf/dispatch [:onboarding-2/profile-data-set
(rf/dispatch [:onboarding/profile-data-set
{:image-path @profile-pic
:display-name @full-name
:color @custom-color}]))
Expand All @@ -232,7 +232,7 @@
(defn create-profile
[]
(let [{:keys [top]} (safe-area/get-insets)
onboarding-profile-data (rf/sub [:onboarding-2/profile])]
onboarding-profile-data (rf/sub [:onboarding/profile])]
[:<>
[:f> f-page
{:navigation-bar-top top
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[insets]
(let [supported-biometric-type (rf/sub [:biometric/supported-type])
bio-type-label (biometric/get-label-by-type supported-biometric-type)
profile-color (or (:color (rf/sub [:onboarding-2/profile]))
profile-color (or (:color (rf/sub [:onboarding/profile]))
(rf/sub [:profile/customization-color]))
syncing-results? (= :syncing-results @state/root-id)]
[rn/view {:style (style/buttons insets)}
Expand All @@ -36,7 +36,7 @@
:accessibility-label :enable-biometrics-button
:icon-left :i/face-id
:customization-color profile-color
:on-press #(rf/dispatch [:onboarding-2/enable-biometrics])
:on-press #(rf/dispatch [:onboarding/enable-biometrics])
:button-label (i18n/label :t/biometric-enable-button {:bio-type-label bio-type-label})}]
[quo/button
{:accessibility-label :maybe-later-button
Expand All @@ -45,7 +45,7 @@
:on-press #(rf/dispatch (if syncing-results?
[:navigate-to-within-stack
[:enable-notifications :enable-biometrics]]
[:onboarding-2/create-account-and-login]))
[:onboarding/create-account-and-login]))
:container-style {:margin-top 12}}
(i18n/label :t/maybe-later)]]))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

(defn enable-notification-buttons
[{:keys [insets]}]
(let [profile-color (rf/sub [:onboarding-2/customization-color])]
(let [profile-color (rf/sub [:onboarding/customization-color])]
[rn/view {:style (style/buttons insets)}
[quo/button
{:on-press (fn []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
(reset! seed-phrase new-phrase))
on-submit (fn []
(swap! seed-phrase clean-seed-phrase)
(rf/dispatch [:onboarding-2/seed-phrase-entered
(rf/dispatch [:onboarding/seed-phrase-entered
(security/mask-data @seed-phrase)
set-invalid-seed-phrase]))]
(let [words-coll (mnemonic/passphrase->words @seed-phrase)
Expand Down
76 changes: 38 additions & 38 deletions src/status_im2/contexts/onboarding/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,57 @@
(on-success mnemonic keyUID)))))))

(rf/defn profile-data-set
{:events [:onboarding-2/profile-data-set]}
{:events [:onboarding/profile-data-set]}
[{:keys [db]} onboarding-data]
{:db (update db :onboarding-2/profile merge onboarding-data)
{:db (update db :onboarding/profile merge onboarding-data)
:dispatch [:navigate-to-within-stack [:create-profile-password :new-to-status]]})

(rf/defn enable-biometrics
{:events [:onboarding-2/enable-biometrics]}
{:events [:onboarding/enable-biometrics]}
[_]
{:biometric/authenticate {:on-success #(rf/dispatch [:onboarding-2/biometrics-done])
:on-fail #(rf/dispatch [:onboarding-2/biometrics-fail %])}})
{:biometric/authenticate {:on-success #(rf/dispatch [:onboarding/biometrics-done])
:on-fail #(rf/dispatch [:onboarding/biometrics-fail %])}})

(rf/defn navigate-to-enable-notifications
{:events [:onboarding-2/navigate-to-enable-notifications]}
{:events [:onboarding/navigate-to-enable-notifications]}
[{:keys [db]}]
(let [key-uid (get-in db [:profile/profile :key-uid])]
{:db (dissoc db :onboarding-2/profile)
{:db (dissoc db :onboarding/profile)
:dispatch [:navigate-to-within-stack [:enable-notifications :enable-biometrics]]}))

(rf/defn biometrics-done
{:events [:onboarding-2/biometrics-done]}
{:events [:onboarding/biometrics-done]}
[{:keys [db]}]
(let [syncing? (get-in db [:onboarding-2/profile :syncing?])]
{:db (assoc-in db [:onboarding-2/profile :auth-method] constants/auth-method-biometric)
(let [syncing? (get-in db [:onboarding/profile :syncing?])]
{:db (assoc-in db [:onboarding/profile :auth-method] constants/auth-method-biometric)
:dispatch (if syncing?
[:onboarding-2/finalize-setup]
[:onboarding-2/create-account-and-login])}))
[:onboarding/finalize-setup]
[:onboarding/create-account-and-login])}))

(rf/defn biometrics-fail
{:events [:onboarding-2/biometrics-fail]}
{:events [:onboarding/biometrics-fail]}
[cofx code]
(biometric/show-message cofx code))

(rf/defn create-account-and-login
{:events [:onboarding-2/create-account-and-login]}
{:events [:onboarding/create-account-and-login]}
[{:keys [db] :as cofx}]
(let [{:keys [display-name seed-phrase password image-path color] :as profile}
(:onboarding-2/profile db)]
(:onboarding/profile db)]
(rf/merge cofx
{:dispatch [:navigate-to-within-stack [:generating-keys :new-to-status]]
:dispatch-later [{:ms constants/onboarding-generating-keys-animation-duration-ms
:dispatch [:onboarding-2/navigate-to-identifiers]}]
:dispatch [:onboarding/navigate-to-identifiers]}]
:db (-> db
(dissoc :profile/login)
(dissoc :auth-method)
(assoc :onboarding-2/new-account? true))}
(assoc :onboarding/new-account? true))}
(if seed-phrase
(profile.recover/recover-profile-and-login profile)
(profile.create/create-profile-and-login profile)))))

(rf/defn on-delete-profile-success
{:events [:onboarding-2/on-delete-profile-success]}
{:events [:onboarding/on-delete-profile-success]}
[{:keys [db]} key-uid]
(let [multiaccounts (dissoc (:profile/profiles-overview db) key-uid)]
(merge
Expand All @@ -83,35 +83,35 @@
{:set-root :intro}))))

(rf/defn password-set
{:events [:onboarding-2/password-set]}
{:events [:onboarding/password-set]}
[{:keys [db]} password]
(let [supported-type (:biometric/supported-type db)]
{:db (-> db
(assoc-in [:onboarding-2/profile :password] password)
(assoc-in [:onboarding-2/profile :auth-method] constants/auth-method-password))
(assoc-in [:onboarding/profile :password] password)
(assoc-in [:onboarding/profile :auth-method] constants/auth-method-password))
:dispatch (if supported-type
[:navigate-to-within-stack [:enable-biometrics :new-to-status]]
[:onboarding-2/create-account-and-login])}))
[:onboarding/create-account-and-login])}))

(rf/defn navigate-to-enable-biometrics
{:events [:onboarding-2/navigate-to-enable-biometrics]}
{:events [:onboarding/navigate-to-enable-biometrics]}
[{:keys [db]}]
(let [supported-type (:biometric/supported-type db)]
{:dispatch (if supported-type
[:open-modal :enable-biometrics]
[:open-modal :enable-notifications])}))

(rf/defn seed-phrase-entered
{:events [:onboarding-2/seed-phrase-entered]}
{:events [:onboarding/seed-phrase-entered]}
[_ seed-phrase on-error]
{:multiaccount/validate-mnemonic [seed-phrase
(fn [mnemonic key-uid]
(re-frame/dispatch [:onboarding-2/seed-phrase-validated
(re-frame/dispatch [:onboarding/seed-phrase-validated
mnemonic key-uid]))
on-error]})

(rf/defn seed-phrase-validated
{:events [:onboarding-2/seed-phrase-validated]}
{:events [:onboarding/seed-phrase-validated]}
[{:keys [db]} seed-phrase key-uid]
(if (contains? (:profile/profiles-overview db) key-uid)
{:utils/show-confirmation
Expand All @@ -123,25 +123,25 @@
(re-frame/dispatch
[:profile/profile-selected key-uid]))
:on-cancel #(re-frame/dispatch [:pop-to-root :multiaccounts])}}
{:db (assoc-in db [:onboarding-2/profile :seed-phrase] seed-phrase)
{:db (assoc-in db [:onboarding/profile :seed-phrase] seed-phrase)
:dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]}))

(rf/defn navigate-to-create-profile
{:events [:onboarding-2/navigate-to-create-profile]}
{:events [:onboarding/navigate-to-create-profile]}
[{:keys [db]}]
;; Restart the flow
{:db (dissoc db :onboarding-2/profile)
{:db (dissoc db :onboarding/profile)
:dispatch [:navigate-to-within-stack [:create-profile :new-to-status]]})

(rf/defn onboarding-new-account-finalize-setup
{:events [:onboarding-2/finalize-setup]}
{:events [:onboarding/finalize-setup]}
[{:keys [db]}]
(let [masked-password (get-in db [:onboarding-2/profile :password])
(let [masked-password (get-in db [:onboarding/profile :password])
key-uid (get-in db [:profile/profile :key-uid])
syncing? (get-in db [:onboarding-2/profile :syncing?])
biometric-enabled? (= (get-in db [:onboarding-2/profile :auth-method])
syncing? (get-in db [:onboarding/profile :syncing?])
biometric-enabled? (= (get-in db [:onboarding/profile :auth-method])
constants/auth-method-biometric)]
(cond-> {:db (assoc db :onboarding-2/generated-keys? true)}
(cond-> {:db (assoc db :onboarding/generated-keys? true)}
biometric-enabled?
(assoc :keychain/save-password-and-auth-method
{:key-uid key-uid
Expand All @@ -150,16 +150,16 @@
(security/hash-masked-password masked-password))
:on-success (fn []
(if syncing?
(rf/dispatch [:onboarding-2/navigate-to-enable-notifications])
(rf/dispatch [:onboarding/navigate-to-enable-notifications])
(log/error "successfully saved biometrics")))
:on-error #(log/error "failed to save biometrics"
{:key-uid key-uid
:error %})}))))

(rf/defn navigate-to-identifiers
{:events [:onboarding-2/navigate-to-identifiers]}
{:events [:onboarding/navigate-to-identifiers]}
[{:keys [db]}]
(if (:onboarding-2/generated-keys? db)
(if (:onboarding/generated-keys? db)
{:dispatch [:navigate-to-within-stack [:identifiers :new-to-status]]}
{:dispatch-later [{:ms constants/onboarding-generating-keys-navigation-retry-ms
:dispatch [:onboarding-2/navigate-to-identifiers]}]}))
:dispatch [:onboarding/navigate-to-identifiers]}]}))
2 changes: 1 addition & 1 deletion src/status_im2/contexts/onboarding/identifiers/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
drag-amount (atom nil)
{:keys [emoji-hash display-name compressed-key
public-key]} (rf/sub [:profile/profile])
{:keys [color]} (rf/sub [:onboarding-2/profile])
{:keys [color]} (rf/sub [:onboarding/profile])
photo-path (rf/sub [:chats/photo-path public-key])
emoji-string (string/join emoji-hash)]
(carousel.animation/use-initialize-animation progress paused? true is-dragging? drag-amount)
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/contexts/onboarding/new_to_status/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
(* 2 56) ;; two other list items
(* 2 16) ;; spacing between items
220) ;; extra spacing (top bar)
:on-press #(rf/dispatch [:onboarding-2/navigate-to-create-profile])}]
:on-press #(rf/dispatch [:onboarding/navigate-to-create-profile])}]
[rn/view {:style style/subtitle-container}
[quo/text
{:style style/subtitle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(defn view
[in-onboarding?]
(let [pairing-status (rf/sub [:pairing/pairing-status])
profile-color (:color (rf/sub [:onboarding-2/profile]))]
profile-color (:color (rf/sub [:onboarding/profile]))]
[rn/view {:style (style/page-container in-onboarding?)}
(when-not in-onboarding? [background/view true])
[quo/page-nav {:type :no-title :background :blur}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{:on-press (fn []
(when on-press
(on-press))
(rf/dispatch [:onboarding-2/navigate-to-enable-biometrics]))
(rf/dispatch [:onboarding/navigate-to-enable-biometrics]))
:accessibility-label :continue-button
:customization-color profile-color
:container-style style/continue-button}
Expand Down
4 changes: 2 additions & 2 deletions src/status_im2/contexts/onboarding/welcome/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

(defn page-title
[]
(let [new-account? (rf/sub [:onboarding-2/new-account?])]
(let [new-account? (rf/sub [:onboarding/new-account?])]
[quo/text-combinations
{:container-style {:margin-top 12 :margin-horizontal 20}
:title (i18n/label (if new-account?
Expand All @@ -31,7 +31,7 @@

(defn view
[]
(let [profile-color (rf/sub [:onboarding-2/customization-color])
(let [profile-color (rf/sub [:onboarding/customization-color])
{:keys [status-type]} (rf/sub [:multiaccount/current-user-visibility-status])
window (rf/sub [:dimensions/window])
insets (safe-area/get-insets)]
Expand Down
10 changes: 5 additions & 5 deletions src/status_im2/contexts/profile/login/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
(let [{:keys [key-uid password]} (get-in db [:syncing :profile])
masked-password (security/mask-data password)]
{:db (-> db
(assoc-in [:onboarding-2/profile :password] masked-password)
(assoc-in [:onboarding-2/profile :syncing?] true))
(assoc-in [:onboarding/profile :password] masked-password)
(assoc-in [:onboarding/profile :syncing?] true))
::login [key-uid password]}))

(rf/defn redirect-to-root
Expand All @@ -66,8 +66,8 @@
{:db (dissoc db :syncing)
:dispatch [:init-root :syncing-results]}

(get db :onboarding-2/new-account?)
{:dispatch [:onboarding-2/finalize-setup]}
(get db :onboarding/new-account?)
{:dispatch [:onboarding/finalize-setup]}

:else
(rf/merge
Expand Down Expand Up @@ -140,7 +140,7 @@
(switcher-cards-store/fetch-switcher-cards-rpc))))

(rf/defn login-node-signal
[{{:onboarding-2/keys [recovered-account? new-account?] :as db} :db :as cofx}
[{{:onboarding/keys [recovered-account? new-account?] :as db} :db :as cofx}
{:keys [settings account ensUsernames error]}]
(log/debug "[signals] node.login" "error" error)
(if error
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/contexts/profile/profiles/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
key-uid
(fn [result]
(let [{:keys [error]} (transforms/json->clj result)]
(rf/dispatch [:onboarding-2/on-delete-profile-success key-uid])
(rf/dispatch [:onboarding/on-delete-profile-success key-uid])
(log/info "profile deleted: error" error)))))}])

(defn show-confirmation
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/contexts/profile/recover/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{:events [:profile.recover/recover-and-login]}
[{:keys [db]} {:keys [display-name password image-path color seed-phrase]}]
{:db
(assoc db :onboarding-2/recovered-account? true)
(assoc db :onboarding/recovered-account? true)

::restore-profile-and-login
(merge (profile.config/create)
Expand Down
6 changes: 3 additions & 3 deletions src/status_im2/subs/onboarding.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
[re-frame.core :as re-frame]))

(re-frame/reg-sub
:onboarding-2/customization-color
:<- [:onboarding-2/profile]
:onboarding/customization-color
:<- [:onboarding/profile]
:<- [:profile/customization-color]
:<- [:onboarding-2/new-account?]
:<- [:onboarding/new-account?]
(fn [[{:keys [color]} customization-color new-account?]]
(if new-account?
color
Expand Down
Loading