fix: appearance switch resets to old ui when new ui is activated

Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
Brian Sztamfater 2022-09-22 14:24:16 -03:00
parent 5fa203c6f2
commit ba1ff91cdd
No known key found for this signature in database
GPG Key ID: 59EB921E0706B48F
2 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,13 @@
:dispatch [:init-root (if @config/new-ui-enabled? :home-stack :chat-stack)] :dispatch [:init-root (if @config/new-ui-enabled? :home-stack :chat-stack)]
::async-storage/set! {:new-ui-enabled? @config/new-ui-enabled?}}) ::async-storage/set! {:new-ui-enabled? @config/new-ui-enabled?}})
(fx/defn reload-new-ui
{:events [:reload-new-ui]}
[_]
(reloader/reload)
{:new-ui/reset-bottom-tabs nil
:dispatch [:init-root :home-stack]})
(fx/defn init-root-nav2 (fx/defn init-root-nav2
{:events [:init-root-nav2]} {:events [:init-root-nav2]}
[_ root-id] [_ root-id]

View File

@ -5,13 +5,14 @@
[status-im.react-native.resources :as resources] [status-im.react-native.resources :as resources]
[quo.core :as quo] [quo.core :as quo]
[quo.design-system.colors :as colors] [quo.design-system.colors :as colors]
[status-im.i18n.i18n :as i18n])) [status-im.i18n.i18n :as i18n]
[status-im.utils.config :as config]))
(defn button [label icon theme selected?] (defn button [label icon theme selected?]
[react/touchable-highlight [react/touchable-highlight
{:on-press (fn [] {:on-press (fn []
(re-frame/dispatch [:multiaccounts.ui/appearance-switched theme]) (re-frame/dispatch [:multiaccounts.ui/appearance-switched theme])
(re-frame/dispatch [:init-root :chat-stack]) (re-frame/dispatch (if @config/new-ui-enabled? [:reload-new-ui] [:init-root :chat-stack]))
(re-frame/dispatch [:navigate-change-tab :profile]) (re-frame/dispatch [:navigate-change-tab :profile])
(js/setTimeout #(re-frame/dispatch [:navigate-to :appearance]) 1000))} (js/setTimeout #(re-frame/dispatch [:navigate-to :appearance]) 1000))}
[react/view (merge {:align-items :center :padding 8 :border-radius 20} [react/view (merge {:align-items :center :padding 8 :border-radius 20}