-
Notifications
You must be signed in to change notification settings - Fork 982
/
effects.cljs
35 lines (32 loc) · 1.23 KB
/
effects.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(ns status-im.contexts.profile.settings.effects
(:require [native-module.core :as native-module]
[re-frame.core :as re-frame]
[react-native.platform :as platform]
[status-im.common.theme.core :as theme]
[status-im.constants :as constants]
[status-im.setup.hot-reload :as hot-reload]
[utils.re-frame :as rf]))
(re-frame/reg-fx
:profile.settings/blank-preview-flag-changed
(fn [flag]
(native-module/set-blank-preview-flag flag)))
(re-frame/reg-fx
:profile.settings/webview-debug-changed
(fn [value]
(when platform/android?
(native-module/toggle-webview-debug value))))
(re-frame/reg-fx
:profile.settings/switch-theme-fx
(fn [[theme-type view-id reload-ui?]]
(let [theme (if (or (= theme-type constants/theme-type-dark)
(and (= theme-type constants/theme-type-system)
(theme/device-theme-dark?)))
:dark
:light)]
(theme/set-legacy-theme theme)
(rf/dispatch [:theme/switch theme])
(rf/dispatch [:reload-status-nav-color view-id])
(when reload-ui?
(re-frame/dispatch [:dismiss-all-overlays])
(when js/goog.DEBUG
(hot-reload/reload))))))