chore: remove hot reload while theme changing (#20663)

This commit is contained in:
Parvesh Monu 2024-07-08 14:51:27 +05:30 committed by GitHub
parent da16d1f69e
commit de6d9a6c3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 23 deletions

View File

@ -108,8 +108,7 @@
(when (and (multiaccounts.model/logged-in? db) (when (and (multiaccounts.model/logged-in? db)
(= current-theme-type status-im.constants/theme-type-system)) (= current-theme-type status-im.constants/theme-type-system))
{:profile.settings/switch-theme-fx {:profile.settings/switch-theme-fx
[(get-in db [:profile/profile :appearance]) [(get-in db [:profile/profile :appearance]) (:view-id db)]})))
(:view-id db) true]})))
(defn- on-biometric-auth-fail (defn- on-biometric-auth-fail
[{:keys [code]}] [{:keys [code]}]

View File

@ -83,8 +83,7 @@
[[:profile.settings/switch-theme-fx [[:profile.settings/switch-theme-fx
[(or (:appearance settings) [(or (:appearance settings)
constants/theme-type-dark) constants/theme-type-dark)
:shell-stack :shell-stack]]
false]]
[:dispatch [:init-root :shell-stack]] [:dispatch [:init-root :shell-stack]]
[:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))}))) [:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))})))

View File

@ -4,7 +4,6 @@
[react-native.platform :as platform] [react-native.platform :as platform]
[status-im.common.theme.core :as theme] [status-im.common.theme.core :as theme]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.setup.hot-reload :as hot-reload]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(re-frame/reg-fx (re-frame/reg-fx
@ -20,7 +19,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:profile.settings/switch-theme-fx :profile.settings/switch-theme-fx
(fn [[theme-type view-id reload-ui?]] (fn [[theme-type view-id]]
(let [theme (if (or (= theme-type constants/theme-type-dark) (let [theme (if (or (= theme-type constants/theme-type-dark)
(and (= theme-type constants/theme-type-system) (and (= theme-type constants/theme-type-system)
(theme/device-theme-dark?))) (theme/device-theme-dark?)))
@ -28,8 +27,4 @@
:light)] :light)]
(theme/set-legacy-theme theme) (theme/set-legacy-theme theme)
(rf/dispatch [:theme/switch theme]) (rf/dispatch [:theme/switch theme])
(rf/dispatch [:reload-status-nav-color view-id]) (rf/dispatch [:reload-status-nav-color view-id]))))
(when reload-ui?
(re-frame/dispatch [:dismiss-all-overlays])
(when js/goog.DEBUG
(hot-reload/reload))))))

View File

@ -95,14 +95,14 @@
(rf/reg-event-fx :profile.settings/change-appearance (rf/reg-event-fx :profile.settings/change-appearance
(fn [_ [theme]] (fn [_ [theme]]
{:fx [[:dispatch [:profile.settings/profile-update :appearance theme]] {:fx [[:dispatch [:profile.settings/profile-update :appearance theme]]
[:profile.settings/switch-theme-fx [theme :appearance true]]]})) [:profile.settings/switch-theme-fx [theme :appearance]]]}))
(rf/reg-event-fx :profile.settings/switch-theme (rf/reg-event-fx :profile.settings/switch-theme
(fn [{:keys [db]} [theme view-id]] (fn [{:keys [db]} [theme view-id]]
(let [theme (or theme (let [theme (or theme
(get-in db [:profile/profile :appearance]) (get-in db [:profile/profile :appearance])
constants/theme-type-dark)] constants/theme-type-dark)]
{:fx [[:profile.settings/switch-theme-fx [theme view-id false]]]}))) {:fx [[:profile.settings/switch-theme-fx [theme view-id]]]})))
(rf/reg-fx :profile.settings/get-profile-picture (rf/reg-fx :profile.settings/get-profile-picture
(fn [key-uid] (fn [key-uid]

View File

@ -123,16 +123,6 @@
(hide-bottom-sheet new-cofx) (hide-bottom-sheet new-cofx)
{:show-bottom-sheet {:theme theme}})))))) {:show-bottom-sheet {:theme theme}}))))))
(rf/defn dismiss-all-overlays
{:events [:dismiss-all-overlays]}
[_]
{:dispatch-n [[:hide-popover]
[:hide-visibility-status-popover]
[:hide-bottom-sheet]
[:bottom-sheet-hidden]
[:bottom-sheet/hide-old-navigation-overlay]
[:toasts/close-all-toasts]]})
(rf/defn set-view-id (rf/defn set-view-id
{:events [:set-view-id]} {:events [:set-view-id]}
[{:keys [db]} view-id] [{:keys [db]} view-id]