Add Test Networks Enabled option in settings (#17879)
This commit is contained in:
parent
fc8590a05f
commit
e5179d308b
|
@ -19,7 +19,8 @@
|
||||||
transactions-management-enabled?
|
transactions-management-enabled?
|
||||||
wakuv2-flag
|
wakuv2-flag
|
||||||
current-fleet
|
current-fleet
|
||||||
webview-debug]}]
|
webview-debug
|
||||||
|
test-networks-enabled?]}]
|
||||||
(keep
|
(keep
|
||||||
identity
|
identity
|
||||||
[{:size :small
|
[{:size :small
|
||||||
|
@ -100,6 +101,14 @@
|
||||||
[:profile.settings/change-webview-debug (not webview-debug)])
|
[:profile.settings/change-webview-debug (not webview-debug)])
|
||||||
:accessory :switch
|
:accessory :switch
|
||||||
:active webview-debug}
|
:active webview-debug}
|
||||||
|
{:size :small
|
||||||
|
:title "Testnet mode"
|
||||||
|
:accessibility-label :test-networks-enabled
|
||||||
|
:container-margin-bottom 8
|
||||||
|
:on-press
|
||||||
|
#(re-frame/dispatch [:profile.settings/toggle-test-networks])
|
||||||
|
:accessory :switch
|
||||||
|
:active test-networks-enabled?}
|
||||||
{:size :small
|
{:size :small
|
||||||
:title (i18n/label :t/waku-bloom-filter-mode)
|
:title (i18n/label :t/waku-bloom-filter-mode)
|
||||||
:accessibility-label :waku-bloom-filter-mode-settings-switch
|
:accessibility-label :waku-bloom-filter-mode-settings-switch
|
||||||
|
@ -128,7 +137,8 @@
|
||||||
|
|
||||||
(views/defview advanced-settings
|
(views/defview advanced-settings
|
||||||
[]
|
[]
|
||||||
(views/letsubs [{:keys [webview-debug]} [:profile/profile]
|
(views/letsubs [{:keys [webview-debug
|
||||||
|
test-networks-enabled?]} [:profile/profile]
|
||||||
network-name [:network-name]
|
network-name [:network-name]
|
||||||
waku-bloom-filter-mode [:waku/bloom-filter-mode]
|
waku-bloom-filter-mode [:waku/bloom-filter-mode]
|
||||||
wakuv2-flag [:waku/v2-flag]
|
wakuv2-flag [:waku/v2-flag]
|
||||||
|
@ -144,6 +154,7 @@
|
||||||
:dev-mode? false
|
:dev-mode? false
|
||||||
:wakuv2-flag wakuv2-flag
|
:wakuv2-flag wakuv2-flag
|
||||||
:waku-bloom-filter-mode waku-bloom-filter-mode
|
:waku-bloom-filter-mode waku-bloom-filter-mode
|
||||||
:webview-debug webview-debug})
|
:webview-debug webview-debug
|
||||||
|
:test-networks-enabled? test-networks-enabled?})
|
||||||
:key-fn (fn [_ i] (str i))
|
:key-fn (fn [_ i] (str i))
|
||||||
:render-fn render-item}]))
|
:render-fn render-item}]))
|
||||||
|
|
|
@ -242,6 +242,7 @@
|
||||||
|
|
||||||
(defn- internal-discover-view
|
(defn- internal-discover-view
|
||||||
[params]
|
[params]
|
||||||
|
(rf/dispatch [:fetch-contract-communities])
|
||||||
[:f> f-view-internal params])
|
[:f> f-view-internal params])
|
||||||
|
|
||||||
(def view (quo.theme/with-theme internal-discover-view))
|
(def view (quo.theme/with-theme internal-discover-view))
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
status-im2.contexts.profile.settings.effects
|
status-im2.contexts.profile.settings.effects
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(rf/defn send-contact-update
|
(rf/defn send-contact-update
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
:on-success #(log/debug "sent contact update")}]}))
|
:on-success #(log/debug "sent contact update")}]}))
|
||||||
|
|
||||||
(rf/defn profile-update
|
(rf/defn profile-update
|
||||||
|
{:events [:profile.settings/profile-update]}
|
||||||
[{:keys [db] :as cofx}
|
[{:keys [db] :as cofx}
|
||||||
setting setting-value
|
setting setting-value
|
||||||
{:keys [dont-sync? on-success] :or {on-success #()}}]
|
{:keys [dont-sync? on-success] :or {on-success #()}}]
|
||||||
|
@ -56,6 +58,18 @@
|
||||||
{:profile.settings/webview-debug-changed value}
|
{:profile.settings/webview-debug-changed value}
|
||||||
(profile-update :webview-debug (boolean value) {})))
|
(profile-update :webview-debug (boolean value) {})))
|
||||||
|
|
||||||
|
(rf/reg-event-fx :profile.settings/toggle-test-networks
|
||||||
|
(fn [{:keys [db]}]
|
||||||
|
(let [value (get-in db [:profile/profile :test-networks-enabled?])
|
||||||
|
on-success #(rf/dispatch [:logout])]
|
||||||
|
{:fx [[:ui/show-confirmation
|
||||||
|
{:title (i18n/label :t/testnet-mode-prompt-title)
|
||||||
|
:content (i18n/label :t/testnet-mode-prompt-content)
|
||||||
|
:on-accept #(rf/dispatch [:profile.settings/profile-update :test-networks-enabled?
|
||||||
|
(not value)
|
||||||
|
{:on-success on-success}])
|
||||||
|
:on-cancel nil}]]})))
|
||||||
|
|
||||||
(rf/defn change-preview-privacy-flag
|
(rf/defn change-preview-privacy-flag
|
||||||
{:events [:profile.settings/change-preview-privacy]}
|
{:events [:profile.settings/change-preview-privacy]}
|
||||||
[{:keys [db] :as cofx} private?]
|
[{:keys [db] :as cofx} private?]
|
||||||
|
|
|
@ -1407,6 +1407,8 @@
|
||||||
"try-keeping-the-card-still": "Try keeping the card still",
|
"try-keeping-the-card-still": "Try keeping the card still",
|
||||||
"turn-nfc-on": "Turn NFC on to continue",
|
"turn-nfc-on": "Turn NFC on to continue",
|
||||||
"turn-nfc-description": "NFC is disabled on yor device. You can enable it in settings",
|
"turn-nfc-description": "NFC is disabled on yor device. You can enable it in settings",
|
||||||
|
"testnet-mode-prompt-title": "Warning!",
|
||||||
|
"testnet-mode-prompt-content": "You are about to switch the network mode. This will log you out and you will have to login again.",
|
||||||
"keycard-init-title": "Looking for cards...",
|
"keycard-init-title": "Looking for cards...",
|
||||||
"keycard-init-description": "Put the card to the back of your phone to continue",
|
"keycard-init-description": "Put the card to the back of your phone to continue",
|
||||||
"keycard-awaiting-title": "Still looking...",
|
"keycard-awaiting-title": "Still looking...",
|
||||||
|
|
Loading…
Reference in New Issue