Add peer syncing toggle in "Advanced settings" (#18906)

* Add peer syncing toggle in "Advanced settings"

* status-go-version.json

* Fixes
This commit is contained in:
Alexander 2024-03-05 12:59:06 +01:00 committed by GitHub
parent e783deb5af
commit 58e9ae0334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 3 deletions

View File

@ -20,7 +20,8 @@
current-fleet
webview-debug
test-networks-enabled?
is-goerli-enabled?]}]
is-goerli-enabled?
peer-syncing-enabled?]}]
(keep
identity
[{:size :small
@ -119,6 +120,14 @@
#(re-frame/dispatch [:profile.settings/toggle-goerli-test-network])
:accessory :switch
:active is-goerli-enabled?}
{:size :small
:title "Peer syncing"
:accessibility-label :peer-syncing
:container-margin-bottom 8
:on-press
#(re-frame/dispatch [:profile.settings/toggle-peer-syncing])
:accessory :switch
:active peer-syncing-enabled?}
{:size :small
:title (i18n/label :t/set-currency)
:accessibility-label :wallet-change-currency
@ -145,7 +154,8 @@
network-name [:network-name]
transactions-management-enabled? [:wallet-legacy/transactions-management-enabled?]
current-log-level [:log-level/current-log-level]
current-fleet [:fleets/current-fleet]]
current-fleet [:fleets/current-fleet]
peer-syncing-enabled? [:profile/peer-syncing-enabled?]]
[list/flat-list
{:data (flat-list-data
{:network-name network-name
@ -156,6 +166,7 @@
:dev-mode? false
:webview-debug webview-debug
:test-networks-enabled? test-networks-enabled?
:is-goerli-enabled? is-goerli-enabled?})
:is-goerli-enabled? is-goerli-enabled?
:peer-syncing-enabled? peer-syncing-enabled?})
:key-fn (fn [_ i] (str i))
:render-fn render-item}]))

View File

@ -1,6 +1,7 @@
(ns status-im.contexts.profile.settings.events
(:require [clojure.string :as string]
[legacy.status-im.bottom-sheet.events :as bottom-sheet.events]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
status-im.contexts.profile.settings.effects
[taoensso.timbre :as log]
@ -91,6 +92,16 @@
(boolean private?)
{})))
(re-frame/reg-event-fx :profile.settings/toggle-peer-syncing
(fn [{:keys [db]}]
(let [value (get-in db [:profile/profile :peer-syncing-enabled?])
new-value (not value)]
{:db (assoc-in db [:profile/profile :peer-syncing-enabled?] new-value)
:fx [[:json-rpc/call
[{:method "wakuext_togglePeerSyncing"
:params [{:enabled new-value}]
:on-error #(log/error "failed to toggle peer syncing" new-value %)}]]]})))
(rf/defn change-profile-pictures-show-to
{:events [:profile.settings/change-profile-pictures-show-to]}
[cofx id]

View File

@ -111,6 +111,12 @@
(fn [profile]
(:is-goerli-enabled? profile)))
(re-frame/reg-sub
:profile/peer-syncing-enabled?
:<- [:profile/profile]
(fn [profile]
(:peer-syncing-enabled? profile)))
(re-frame/reg-sub
:multiaccount/contact
:<- [:profile/profile]