Skip to content

Commit

Permalink
Merge branch 'develop' into 15569
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil authored Apr 17, 2023
2 parents 186793c + 512af40 commit 7863ff0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
39 changes: 21 additions & 18 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,25 @@
[_]
(status/get-node-config #(re-frame/dispatch [::get-node-config-callback %])))

(rf/defn redirect-to-root
"Decides which root should be initialised depending on user and app state"
[{:keys [db] :as cofx}]
(cond
(get db :onboarding-2/new-account?)
{:dispatch [:onboarding-2/finalize-setup]}

(get db :tos/accepted?)
(rf/merge
cofx
(multiaccounts/switch-theme nil :shell-stack)
(navigation/init-root :shell-stack))

:else
{:dispatch [:init-root :tos]}))

(rf/defn get-settings-callback
{:events [::get-settings-callback]}
[{:keys [db] :as cofx} settings]
[{:keys [db] :as cofx} settings pairing-in-progress?]
(let [{:networks/keys [current-network networks]
:as settings}
(data-store.settings/rpc->settings settings)
Expand Down Expand Up @@ -397,7 +413,9 @@
(logging/set-log-level (:log-level multiaccount))
(activity-center/notifications-fetch-pending-contact-requests)
(activity-center/update-seen-state)
(activity-center/notifications-fetch-unread-count))))
(activity-center/notifications-fetch-unread-count)
(when-not pairing-in-progress?
(redirect-to-root)))))

(re-frame/reg-fx
::open-last-chat
Expand Down Expand Up @@ -472,19 +490,6 @@
keychain/auth-method-biometric
keychain/auth-method-password))))

(defn redirect-to-root
"Decides which root should be initialised depending on user and app state"
[db]
(cond
(get db :onboarding-2/new-account?)
(re-frame/dispatch [:onboarding-2/finalize-setup])

(get db :tos/accepted?)
(re-frame/dispatch [:init-root :shell-stack])

:else
(re-frame/dispatch [:init-root :tos])))

(rf/defn login-only-events
[{:keys [db] :as cofx} key-uid password save-password?]
(let [auth-method (:auth-method db)
Expand All @@ -497,9 +502,7 @@
{:db (assoc db :chats/loading? true)
:json-rpc/call
[{:method "settings_getSettings"
:on-success #(do (re-frame/dispatch [::get-settings-callback %])
(when-not pairing-in-progress?
(redirect-to-root db)))}]}
:on-success #(re-frame/dispatch [::get-settings-callback % pairing-in-progress?])}]}
(notifications/load-notification-preferences)
(when save-password?
(keychain/save-user-password key-uid password))
Expand Down
14 changes: 9 additions & 5 deletions src/status_im2/navigation/options.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@
{:layout {:orientation :portrait}
:topBar {:visible false}})

;; Note: Currently, the status bar style provided while setting the root has a high preference,
;; and even if we change the status bar style later dynamically, the style gets restored to this
;; set root style while navigating
;; https://github.com/status-im/status-mobile/pull/15596
(defn statusbar-and-navbar-root
[]
[& [status-bar-theme]]
(if platform/android?
{:navigationBar {:backgroundColor colors/neutral-100}
:statusBar {:translucent true
:backgroundColor :transparent
:style :light
:style (or status-bar-theme :light)
:drawBehind true}}
{:statusBar {:style :light}}))
{:statusBar {:style (or status-bar-theme :light)}}))

(defn default-root
[]
(merge (statusbar-and-navbar-root)
[& [status-bar-theme]]
(merge (statusbar-and-navbar-root status-bar-theme)
{:topBar {:visible false}
:layout {:componentBackgroundColor (colors/theme-colors colors/white colors/neutral-100)
:orientation :portrait
Expand Down
4 changes: 3 additions & 1 deletion src/status_im2/navigation/roots.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns status-im2.navigation.roots
(:require [status-im2.navigation.view :as views]
[quo2.foundations.colors :as colors]
[status-im2.navigation.options :as options]
[status-im2.constants :as constants]))

Expand Down Expand Up @@ -101,7 +102,8 @@
{:stack {:id :shell-stack
:children [{:component {:name :shell-stack
:id :shell-stack
:options (options/default-root)}}]}}}
:options (options/default-root
(if (colors/dark?) :light :dark))}}]}}}
:profiles
{:root
{:stack {:id :profiles
Expand Down

0 comments on commit 7863ff0

Please sign in to comment.