diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index f4bf8b18cb..2f8f1ac002 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -28,6 +28,7 @@ const GeminiScrollbar = require('react-gemini-scrollbar'); const Email = require('../../email'); const AddThreepid = require('../../AddThreepid'); const SdkConfig = require('../../SdkConfig'); +import Analytics from '../../Analytics'; import AccessibleButton from '../views/elements/AccessibleButton'; import { _t } from '../../languageHandler'; import * as languageHandler from '../../languageHandler'; @@ -55,7 +56,7 @@ const gHVersionLabel = function(repo, token='') { // Enumerate some simple 'flip a bit' UI settings (if any). // 'id' gives the key name in the im.vector.web.settings account data event // 'label' is how we describe it in the UI. -// Warning: Each "label" string below must be added to i18n/strings/en_EN.json, +// Warning: Each "label" string below must be added to i18n/strings/en_EN.json, // since they will be translated when rendered. const SETTINGS_LABELS = [ { @@ -90,7 +91,7 @@ const SETTINGS_LABELS = [ */ ]; -// Warning: Each "label" string below must be added to i18n/strings/en_EN.json, +// Warning: Each "label" string below must be added to i18n/strings/en_EN.json, // since they will be translated when rendered. const CRYPTO_SETTINGS_LABELS = [ { @@ -722,6 +723,30 @@ module.exports = React.createClass({ ); }, + _onAnalyticsOptOut: function(ev) { + UserSettingsStore.setSyncedSetting('analyticsOptOut', ev.target.checked); + Analytics[ev.target.checked ? 'disable' : 'enable'](); + }, + + _renderAnalyticsControl: function() { + return
+

{ _t('Analytics') }

+
+ {_t('Riot collects anonymous analytics to allow us to improve the application.')} +
+ + +
+
+
; + }, + _renderLabs: function() { // default to enabled if undefined if (this.props.enableLabs === false) return null; @@ -1019,6 +1044,8 @@ module.exports = React.createClass({ {this._renderBulkOptions()} {this._renderBugReport()} + {this._renderAnalyticsControl()} +

{ _t("Advanced") }

diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4105594058..1bf681f136 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -678,5 +678,8 @@ "%(severalUsers)schanged their avatar %(repeats)s times": "%(severalUsers)schanged their avatar %(repeats)s times", "%(oneUser)schanged their avatar %(repeats)s times": "%(oneUser)schanged their avatar %(repeats)s times", "%(severalUsers)schanged their avatar": "%(severalUsers)schanged their avatar", - "%(oneUser)schanged their avatar": "%(oneUser)schanged their avatar" + "%(oneUser)schanged their avatar": "%(oneUser)schanged their avatar", + "Analytics": "Analytics", + "Opt out of analytics": "Opt out of analytics", + "Riot collects anonymous analytics to allow us to improve the application.": "Riot collects anonymous analytics to allow us to improve the application." }