[ISSUE #3538] Added sharing data settings
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
f7120184a4
commit
5529772858
|
@ -25,6 +25,8 @@
|
|||
:add "Add"
|
||||
:yes "Yes"
|
||||
:no "No"
|
||||
:on "On"
|
||||
:off "Off"
|
||||
|
||||
:camera-access-error "To grant the required camera permission, please go to your system settings and make sure that Status > Camera is selected."
|
||||
:photos-access-error "To grant the required photos permission, please go to your system settings and make sure that Status > Photos is selected."
|
||||
|
@ -47,6 +49,7 @@
|
|||
:sign-you-in "Signing you in…"
|
||||
|
||||
:help-improve "Help improve Status\nby sharing usage patterns"
|
||||
:help-improve? "Help improve Status?"
|
||||
:help-improve-description "We collect anonymous data to help improve Status."
|
||||
:share-usage-data "Share usage"
|
||||
:dont-want-to-share "No, I don't want to share"
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
:account-set-name
|
||||
(fn [{{:accounts/keys [create] :as db} :db} _]
|
||||
(-> {:db (assoc-in db [:accounts/create :show-welcome?] true)
|
||||
:dispatch [:navigate-to-clean :usage-data]}
|
||||
:dispatch [:navigate-to-clean :usage-data [:account-finalized]]}
|
||||
(account-update {:name (:name create)}))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
|
|
|
@ -106,13 +106,16 @@
|
|||
(spec/def :navigation.screen-params.dapp-description/dapp :new/open-dapp)
|
||||
(spec/def :navigation.screen-params/dapp-description map?)
|
||||
|
||||
(spec/def :navigation.screen-params/usage-data vector?)
|
||||
|
||||
(spec/def :navigation/screen-params (spec/nilable (allowed-keys :opt-un [:navigation.screen-params/network-details
|
||||
:navigation.screen-params/browser
|
||||
:navigation.screen-params/profile-qr-viewer
|
||||
:navigation.screen-params/qr-scanner
|
||||
:navigation.screen-params/group-contacts
|
||||
:navigation.screen-params/edit-contact-group
|
||||
:navigation.screen-params/dapp-description])))
|
||||
:navigation.screen-params/dapp-description
|
||||
:navigation.screen-params/usage-data])))
|
||||
|
||||
(spec/def :desktop/desktop (spec/nilable any?))
|
||||
|
||||
|
|
|
@ -23,10 +23,14 @@
|
|||
|
||||
;; public fns
|
||||
|
||||
(defn navigate-to-clean [db view-id]
|
||||
(-> db
|
||||
(assoc :navigation-stack (list))
|
||||
(push-view view-id)))
|
||||
(defn navigate-to-clean
|
||||
([db view-id] (navigate-to-clean db view-id nil))
|
||||
([db view-id screen-params]
|
||||
;; TODO (jeluard) Unify all :navigate-to flavours. Maybe accept a map of parameters?
|
||||
(let [db (cond-> db
|
||||
(seq screen-params)
|
||||
(assoc-in [:navigation/screen-params view-id] screen-params))]
|
||||
(push-view db view-id))))
|
||||
|
||||
(defmulti preload-data!
|
||||
(fn [db [_ view-id]] (or view-id (:view-id db))))
|
||||
|
@ -96,8 +100,8 @@
|
|||
|
||||
(register-handler-db
|
||||
:navigate-to-clean
|
||||
(fn [db [_ view-id]]
|
||||
(navigate-to-clean db view-id)))
|
||||
(fn [db [_ & params]]
|
||||
(apply navigate-to db params)))
|
||||
|
||||
(register-handler-db
|
||||
:navigate-to-tab
|
||||
|
|
|
@ -127,7 +127,8 @@
|
|||
:action-fn #(handle-logout sharing-usage-data?)}]]))
|
||||
|
||||
(defview advanced [{:keys [network networks dev-mode?]}]
|
||||
(letsubs [advanced? [:get :my-profile/advanced?]]
|
||||
(letsubs [advanced? [:get :my-profile/advanced?]
|
||||
{:keys [sharing-usage-data?]} [:get-current-account]]
|
||||
[react/view
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:set :my-profile/advanced? (not advanced?)])
|
||||
:style styles/advanced-button}
|
||||
|
@ -155,7 +156,13 @@
|
|||
[profile.components/settings-switch-item
|
||||
{:label-kw :t/dev-mode
|
||||
:value dev-mode?
|
||||
:action-fn #(re-frame/dispatch [:switch-dev-mode %])}]])]))
|
||||
:action-fn #(re-frame/dispatch [:switch-dev-mode %])}]
|
||||
[profile.components/settings-item-separator]
|
||||
[profile.components/settings-item
|
||||
{:label-kw :t/help-improve?
|
||||
:value (i18n/label (if sharing-usage-data? :on :off))
|
||||
:action-fn #(re-frame/dispatch [:navigate-to :usage-data [:navigate-back]])
|
||||
:accessibility-label :help-improve}]])]))
|
||||
|
||||
(defview my-profile []
|
||||
(letsubs [{:keys [public-key sharing-usage-data?] :as current-account} [:get-current-account]
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
|
||||
(handlers/register-handler-fx
|
||||
:help-improve-handler
|
||||
(fn [{db :db} [_ yes? address]]
|
||||
(merge (when yes?
|
||||
(accounts/account-update {:db db} {:sharing-usage-data? true}))
|
||||
{:dispatch-n [(when yes? [:register-mixpanel-tracking address])
|
||||
[:account-finalized]]})))
|
||||
(fn [{db :db} [_ yes? address next]]
|
||||
(merge (accounts/account-update {:db db} {:sharing-usage-data? yes?})
|
||||
{:dispatch-n [(if yes?
|
||||
[:register-mixpanel-tracking address]
|
||||
[:unregister-mixpanel-tracking])
|
||||
next]})))
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
(ns status-im.ui.screens.usage-data.views
|
||||
(:require-macros [status-im.utils.views :as views])
|
||||
(:require [status-im.ui.components.react :as react]
|
||||
[re-frame.core :as re-frame]
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.i18n :as i18n]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.ui.components.common.common :as components.common]
|
||||
[status-im.ui.screens.usage-data.styles :as styles]
|
||||
[status-im.i18n :as i18n]
|
||||
[status-im.ui.components.status-bar.view :as status-bar]))
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.components.status-bar.view :as status-bar]
|
||||
[status-im.ui.screens.usage-data.styles :as styles]))
|
||||
|
||||
(views/defview usage-data []
|
||||
(views/letsubs [account [:get-current-account]]
|
||||
(views/letsubs [next [:get-screen-params]
|
||||
account [:get-current-account]]
|
||||
[react/view {:style styles/usage-data-view}
|
||||
[status-bar/status-bar {:flat? true}]
|
||||
[react/view {:style styles/logo-container}
|
||||
|
@ -23,9 +24,9 @@
|
|||
(i18n/label :t/help-improve-description)]]
|
||||
[react/view styles/buttons-container
|
||||
[components.common/button {:style {:flex-direction :row}
|
||||
:on-press #(re-frame/dispatch [:help-improve-handler true (:address account)])
|
||||
:on-press #(re-frame/dispatch [:help-improve-handler true (:address account) next])
|
||||
:label (i18n/label :t/share-usage-data)}]
|
||||
[react/view styles/bottom-button-container
|
||||
[components.common/button {:on-press #(re-frame/dispatch [:help-improve-handler false (:address account)])
|
||||
[components.common/button {:on-press #(re-frame/dispatch [:help-improve-handler false (:address account) next])
|
||||
:label (i18n/label :t/dont-want-to-share)
|
||||
:background? false}]]]]))
|
||||
|
|
Loading…
Reference in New Issue