diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index 39b532f3040..8f44a38b26a 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -16,10 +16,9 @@ (defn- normal-mode-settings-data [{:keys [current-log-level + telemetry-enabled? light-client-enabled? - transactions-management-enabled? current-fleet - webview-debug test-networks-enabled? is-goerli-enabled? peer-syncing-enabled?]}] @@ -62,33 +61,22 @@ #(re-frame/dispatch [:open-modal :peers-stats]) :chevron true} {:size :small - :title (i18n/label :t/light-client-enabled) - :accessibility-label :light-client-enabled - :container-margin-bottom 8 - :on-press - #(re-frame/dispatch - [:wakuv2.ui/toggle-light-client (not light-client-enabled?)]) - :accessory :switch - :active light-client-enabled?} - {:size :small - :title (i18n/label :t/transactions-management-enabled) - :accessibility-label :transactions-management-enabled + :title "Telemetry" + :accessibility-label :telemetry-enabled :container-margin-bottom 8 :on-press - #(re-frame/dispatch - [:multiaccounts.ui/switch-transactions-management-enabled - (not transactions-management-enabled?)]) + #(re-frame/dispatch [:profile.settings/toggle-telemetry]) :accessory :switch - :active transactions-management-enabled?} + :active telemetry-enabled?} {:size :small - :title "Webview debug" - :accessibility-label :webview-debug-switch + :title (i18n/label :t/light-client-enabled) + :accessibility-label :light-client-enabled :container-margin-bottom 8 :on-press #(re-frame/dispatch - [:profile.settings/change-webview-debug (not webview-debug)]) + [:wakuv2.ui/toggle-light-client (not light-client-enabled?)]) :accessory :switch - :active webview-debug} + :active light-client-enabled?} {:size :small :title "Testnet mode" :accessibility-label :test-networks-enabled @@ -126,14 +114,13 @@ (views/defview advanced-settings [] - (views/letsubs [test-networks-enabled? [:profile/test-networks-enabled?] - is-goerli-enabled? [:profile/is-goerli-enabled?] - light-client-enabled? [:profile/light-client-enabled?] - webview-debug [:profile/webview-debug] - transactions-management-enabled? [:wallet-legacy/transactions-management-enabled?] - current-log-level [:log-level/current-log-level] - current-fleet [:fleets/current-fleet] - peer-syncing-enabled? [:profile/peer-syncing-enabled?]] + (views/letsubs [test-networks-enabled? [:profile/test-networks-enabled?] + is-goerli-enabled? [:profile/is-goerli-enabled?] + light-client-enabled? [:profile/light-client-enabled?] + telemetry-enabled? [:profile/telemetry-enabled?] + current-log-level [:log-level/current-log-level] + current-fleet [:fleets/current-fleet] + peer-syncing-enabled? [:profile/peer-syncing-enabled?]] [:<> [quo/page-nav {:type :title @@ -143,14 +130,13 @@ :on-press #(rf/dispatch [:navigate-back])}] [list/flat-list {:data (flat-list-data - {:current-log-level current-log-level - :transactions-management-enabled? transactions-management-enabled? - :light-client-enabled? light-client-enabled? - :current-fleet current-fleet - :dev-mode? false - :webview-debug webview-debug - :test-networks-enabled? test-networks-enabled? - :is-goerli-enabled? is-goerli-enabled? - :peer-syncing-enabled? peer-syncing-enabled?}) + {:current-log-level current-log-level + :telemetry-enabled? telemetry-enabled? + :light-client-enabled? light-client-enabled? + :current-fleet current-fleet + :dev-mode? false + :test-networks-enabled? test-networks-enabled? + :is-goerli-enabled? is-goerli-enabled? + :peer-syncing-enabled? peer-syncing-enabled?}) :key-fn (fn [_ i] (str i)) :render-fn render-item}]])) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index c8744f941b3..ded6ae10b0d 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -493,3 +493,5 @@ (def ^:const status-hostname "status.app") (def ^:const community-joined-notification-type "communityJoined") + +(def ^:const default-telemetry-server-url "https://telemetry.status.im") diff --git a/src/status_im/contexts/profile/settings/events.cljs b/src/status_im/contexts/profile/settings/events.cljs index cccac1f8c65..6126114e721 100644 --- a/src/status_im/contexts/profile/settings/events.cljs +++ b/src/status_im/contexts/profile/settings/events.cljs @@ -86,6 +86,12 @@ :params [{:enabled new-value}] :on-error #(log/error "failed to toggle peer syncing" new-value %)}]]]}))) +(rf/reg-event-fx :profile.settings/toggle-telemetry + (fn [{:keys [db]}] + (let [value (get-in db [:profile/profile :telemetry-server-url]) + new-value (if (string/blank? value) constants/default-telemetry-server-url "")] + {:dispatch [:profile.settings/profile-update :telemetry-server-url new-value]}))) + (rf/reg-event-fx :profile.settings/change-appearance (fn [_ [theme]] {:fx [[:dispatch [:profile.settings/profile-update :appearance theme]] diff --git a/src/status_im/subs/profile.cljs b/src/status_im/subs/profile.cljs index fc66578d653..1f38431fd22 100644 --- a/src/status_im/subs/profile.cljs +++ b/src/status_im/subs/profile.cljs @@ -87,6 +87,12 @@ (fn [profile] (get-in profile [:wakuv2-config :LightClient]))) +(re-frame/reg-sub + :profile/telemetry-enabled? + :<- [:profile/profile] + (fn [profile] + (not (string/blank? (:telemetry-server-url profile))))) + (re-frame/reg-sub :profile/test-networks-enabled? :<- [:profile/profile]