diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index c01a7d2cc7..a59803ac11 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -91,6 +91,16 @@ const SETTINGS_LABELS = [ */ ]; +const ANALYTICS_SETTINGS_LABELS = [ + { + id: 'analyticsOptOut', + label: 'Opt out of analytics', + fn: function(checked) { + Analytics[checked ? 'disable' : 'enable'](); + }, + }, +]; + // 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 = [ @@ -728,26 +738,12 @@ 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.')} -
- - -
+ {ANALYTICS_SETTINGS_LABELS.map( this._renderLocalSetting )}
; },