fix: Not visible status bar on light theme (#21105)

The issue occurred because we updated the theme value after setting the root
(not before), which caused the root to be initialized with the old theme value.
This commit is contained in:
Parvesh Monu 2024-08-22 17:24:14 +05:30 committed by GitHub
parent 6bf1aecb6d
commit 449b2808e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 17 additions and 11 deletions

View File

@ -30,7 +30,7 @@
[{:keys [db] :as cofx} {:keys [auth-method logout?]}]
(let [key-uid (get-in db [:profile/profile :key-uid])]
(rf/merge cofx
{:dispatch [:init-root :progress]
{:dispatch [:update-theme-and-init-root :progress]
:effects.shell/reset-state nil
:hide-popover nil
::logout nil

View File

@ -91,7 +91,7 @@
(merge
{:db (assoc db :profile/profiles-overview multiaccounts)}
(when-not (seq multiaccounts)
{:dispatch [:init-root :screen/onboarding.intro]}))))
{:dispatch [:update-theme-and-init-root :screen/onboarding.intro]}))))
(rf/defn password-set
{:events [:onboarding/password-set]}

View File

@ -45,7 +45,7 @@
:colors [colors/neutral-100-opa-0 colors/neutral-100-opa-80]}])
[quo/button
{:on-press (fn []
(rf/dispatch [:init-root :shell-stack])
(rf/dispatch [:update-theme-and-init-root :shell-stack])
(rf/dispatch [:profile/show-testnet-mode-banner-if-enabled])
(rf/dispatch [:universal-links/process-stored-event]))
:type :primary

View File

@ -25,4 +25,4 @@
(rf/dispatch [:navigate-back])
(do
(rf/dispatch [:theme/switch {:theme :dark}])
(rf/dispatch [:init-root root])))}]))
(rf/dispatch [:update-theme-and-init-root root])))}]))

View File

@ -53,7 +53,7 @@
(assoc :profile/profiles-overview profiles)
(update :profile/login #(select-profile % key-uid)))
db-with-settings)
:fx [[:dispatch [:init-root :screen/profile.profiles]]
:fx [[:dispatch [:update-theme-and-init-root :screen/profile.profiles]]
(when (and key-uid userConfirmed)
[:effects.biometric/check-if-available
{:key-uid key-uid
@ -61,7 +61,7 @@
(rf/dispatch [:profile.login/check-biometric-success key-uid
auth-method]))}])]})
{:db db-with-settings
:fx [[:dispatch [:init-root :screen/onboarding.intro]]]}))))
:fx [[:dispatch [:update-theme-and-init-root :screen/onboarding.intro]]]}))))
(rf/reg-event-fx
:profile/update-setting-from-backup

View File

@ -73,13 +73,13 @@
(cond
pairing-completed?
[[:dispatch [:init-root :screen/onboarding.syncing-results]]]
[[:dispatch [:update-theme-and-init-root :screen/onboarding.syncing-results]]]
(get db :onboarding/new-account?)
[[:dispatch [:onboarding/finalize-setup]]]
:else
[[:dispatch [:init-root :shell-stack]]
[[:dispatch [:update-theme-and-init-root :shell-stack]]
[:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))})))
;; login phase 2: we want to load and show chats faster, so we split login into 2 phases
@ -185,7 +185,7 @@
{:db (-> db
(assoc-in [:profile/login :password] password)
(assoc-in [:profile/login :processing] true))
:fx [[:dispatch [:init-root :progress]]
:fx [[:dispatch [:update-theme-and-init-root :progress]]
[:effects.profile/login
[(get-in db [:profile/login :key-uid])
(security/safe-unmask-data password)]]]})))

View File

@ -29,7 +29,7 @@
(re-frame/dispatch [:bottom-sheet-hidden])
(when @state/root-id
(reset! theme/device-theme (rn/get-color-scheme))
(re-frame/dispatch [:init-root @state/root-id])
(re-frame/dispatch [:update-theme-and-init-root @state/root-id])
(re-frame/dispatch [:chat/check-last-chat])
(re-frame/dispatch [:alert-banners/restore-alert-banners]))
(rn/hide-splash-screen)))

View File

@ -74,7 +74,6 @@
(let [[status-bar-theme] (get-status-nav-color root-id theme)
root (get (roots/roots status-bar-theme) root-id)]
(dismiss-all-modals)
(rf/dispatch [:theme/switch {:view-id root-id}])
(reset! state/root-id (or (get-in root [:root :stack :id]) root-id))
(navigation/set-root root)
(state/navigation-state-reset [{:id root-id

View File

@ -70,10 +70,17 @@
(assoc :dispatch [:chat/close (:current-chat-id db)])))
(rf/defn init-root
"WARNING: Use `:update-theme-and-init-root` instead. `:init-root` should not be used directly."
{:events [:init-root]}
[{:keys [db]} root-id]
{:set-root [root-id (:theme db)]})
(rf/defn update-theme-and-init-root
{:events [:update-theme-and-init-root]}
[_ root-id]
{:fx [[:dispatch [:theme/switch {:view-id root-id}]]
[:dispatch [:init-root root-id]]]})
(rf/defn change-tab
{:events [:navigate-change-tab]}
[{:keys [db]} stack-id]