rename onboarding 2 (#18060)

This commit is contained in:
flexsurfer 2023-12-04 14:49:05 +01:00 committed by GitHub
parent 56d135f1f8
commit 64453716b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 69 additions and 69 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)
@ -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)]]]]))))

View File

@ -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}]))
@ -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

View File

@ -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)}
@ -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
@ -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)]]))

View File

@ -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 []

View File

@ -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)

View File

@ -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
@ -83,18 +83,18 @@
{: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
@ -102,16 +102,16 @@
[: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
@ -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
@ -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]}]}))

View File

@ -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)

View File

@ -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

View File

@ -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}]

View File

@ -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}

View File

@ -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?
@ -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)]

View File

@ -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
@ -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
@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -61,9 +61,9 @@
(reg-root-key-sub :initials-avatar-font-file :initials-avatar-font-file)
;;onboarding
(reg-root-key-sub :onboarding-2/generated-keys? :onboarding-2/generated-keys?)
(reg-root-key-sub :onboarding-2/new-account? :onboarding-2/new-account?)
(reg-root-key-sub :onboarding-2/profile :onboarding-2/profile)
(reg-root-key-sub :onboarding/generated-keys? :onboarding/generated-keys?)
(reg-root-key-sub :onboarding/new-account? :onboarding/new-account?)
(reg-root-key-sub :onboarding/profile :onboarding/profile)
;;shell
(reg-root-key-sub :shell/switcher-cards :shell/switcher-cards)