hide dev mode setting

This commit is contained in:
Andrey Shovkoplyas 2019-12-16 15:31:02 +01:00
parent 2c3e831a03
commit b84139013a
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
4 changed files with 23 additions and 128 deletions

View File

@ -116,21 +116,6 @@
(fn [cofx [_ desktop-notifications?]]
(multiaccounts/enable-notifications cofx desktop-notifications?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-datasync
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-datasync cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-v1-messages
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-v1-messages cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/toggle-disable-discovery-topic
(fn [cofx [_ enabled?]]
(multiaccounts/toggle-disable-discovery-topic cofx enabled?)))
(handlers/register-handler-fx
:multiaccounts.ui/preview-privacy-mode-switched
(fn [cofx [_ private?]]

View File

@ -90,47 +90,6 @@
{:desktop-notifications? desktop-notifications?}
{}))
(fx/defn toggle-datasync
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup
{:title (i18n/label :t/datasync-warning-title)
:content (i18n/label :t/datasync-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings
(assoc settings :datasync? enabled?)
{}))))
(fx/defn toggle-v1-messages
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup
{:title (i18n/label :t/v1-messages-warning-title)
:content (i18n/label :t/v1-messages-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings
(assoc settings :v1-messages? enabled?)
{}))))
(fx/defn toggle-disable-discovery-topic
[{:keys [db] :as cofx} enabled?]
(let [settings (get-in db [:multiaccount :settings])
warning {:utils/show-popup
{:title
(i18n/label :t/disable-discovery-topic-warning-title)
:content
(i18n/label :t/disable-discovery-topic-warning-content)}}]
(fx/merge cofx
(when enabled? warning)
(multiaccounts.update/update-settings
(assoc settings :disable-discovery-topic? enabled?)
{}))))
(fx/defn switch-preview-privacy-mode
[{:keys [db] :as cofx} private?]
(let [settings (get-in db [:multiaccount :settings])]

View File

@ -103,10 +103,7 @@
{:keys [installation-id settings bootnodes]
:or {settings constants/default-multiaccount-settings}} multiaccount
use-custom-bootnodes (get-in settings [:bootnodes current-network])
log-level (get-log-level settings)
datasync? (:datasync? settings)
disable-discovery-topic? (:disable-discovery-topic? settings)
v1-messages? (:v1-messages? settings)]
log-level (get-log-level settings)]
(cond-> (get-in networks [current-network :config])
:always
(get-base-node-config)
@ -140,9 +137,7 @@
:InstallationID installation-id
:MaxMessageDeliveryAttempts config/max-message-delivery-attempts
:MailServerConfirmations config/mailserver-confirmations-enabled?
:DataSyncEnabled (boolean datasync?)
:DisableGenericDiscoveryTopic (boolean disable-discovery-topic?)
:SendV1Messages (boolean v1-messages?)
:DataSyncEnabled true
:PFSEnabled true}
:RequireTopics (get-topics current-network)
:StatusAccountsConfig {:Enabled true})

View File

@ -39,69 +39,27 @@
:on-press
#(re-frame/dispatch [:navigate-to :bootnodes-settings])
:accessories [:chevron]}
{:type :small
:title :t/dev-mode
:accessibility-label :dev-mode-settings-switch
:container-margin-bottom 8
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/dev-mode-switched (not dev-mode?)])
:accessories
[[react/switch
{:track-color #js {:true colors/blue :false nil}
:value dev-mode?
:on-value-change
#(re-frame/dispatch
[:multiaccounts.ui/dev-mode-switched (not dev-mode?)])
:disabled false}]]}
{:type :divider}])
#_{:type :small
:title :t/dev-mode
:accessibility-label :dev-mode-settings-switch
:container-margin-bottom 8
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/dev-mode-switched (not dev-mode?)])
:accessories
[[react/switch
{:track-color #js {:true colors/blue :false nil}
:value dev-mode?
:on-value-change
#(re-frame/dispatch
[:multiaccounts.ui/dev-mode-switched (not dev-mode?)])
:disabled false}]]}
#_{:type :divider}])
(defn- dev-mode-settings-data [settings chaos-mode?]
(defn- dev-mode-settings-data [chaos-mode?]
[{:container-margin-top 8
:type :section-header
:title :t/dev-mode-settings}
{:type :small
:title :t/datasync
:accessibility-label :datasync-settings-switch
:accessories
[[react/switch
{:track-color #js {:true colors/blue :false nil}
:value (boolean (:datasync? settings))
:on-value-change
#(re-frame/dispatch [:multiaccounts.ui/toggle-datasync %])
:disabled false}]]
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/toggle-datasync
((complement boolean) (:datasync? settings))])}
{:type :small
:title :t/v1-messages
:accessibility-label :v1-messages-settings-switch
:accessories
[[react/switch
{:track-color #js {:true colors/blue :false nil}
:value (boolean (:v1-messages? settings))
:on-value-change
#(re-frame/dispatch [:multiaccounts.ui/toggle-v1-messages %])
:disabled false}]]
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/toggle-v1-messages
((complement boolean) (:v1-messages? settings))])}
{:type :small
:title :t/disable-discovery-topic
:accessibility-label :discovery-topic-settings-switch
:accessories
[[react/switch
{:track-color #js {:true colors/blue :false nil}
:value (boolean (:disable-discovery-topic? settings))
:on-value-change
#(re-frame/dispatch [:multiaccounts.ui/toggle-disable-discovery-topic %])
:disabled false}]]
:on-press
#(re-frame/dispatch
[:multiaccounts.ui/toggle-disable-discovery-topic
((complement boolean) (:disable-discovery-topic? settings))])}
{:type :small
:title :t/chaos-mode
:accessibility-label :chaos-mode-settings-switch
@ -119,19 +77,18 @@
[react/view {:height 24}]])
(defn- flat-list-data [network-name current-log-level current-fleet
dev-mode? settings chaos-mode?]
dev-mode? chaos-mode?]
(if dev-mode?
(into
(normal-mode-settings-data
network-name current-log-level current-fleet dev-mode?)
(dev-mode-settings-data
settings chaos-mode?))
(dev-mode-settings-data chaos-mode?))
;; else
(normal-mode-settings-data
network-name current-log-level current-fleet dev-mode?)))
(views/defview advanced-settings []
(views/letsubs [{:keys [chaos-mode? dev-mode? settings]} [:multiaccount]
(views/letsubs [{:keys [chaos-mode?]} [:multiaccount]
network-name [:network-name]
current-log-level [:settings/current-log-level]
current-fleet [:settings/current-fleet]]
@ -141,8 +98,7 @@
[list/flat-list
{:data (flat-list-data
network-name current-log-level
current-fleet dev-mode? settings
chaos-mode?)
current-fleet false chaos-mode?)
:key-fn (fn [_ i] (str i))
:render-fn list/flat-list-generic-render-fn}]]))