make analytics setting use new thing
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
97d0c41d30
commit
9b8dcaf274
1 changed files with 11 additions and 15 deletions
|
@ -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,
|
// Warning: Each "label" string below must be added to i18n/strings/en_EN.json,
|
||||||
// since they will be translated when rendered.
|
// since they will be translated when rendered.
|
||||||
const CRYPTO_SETTINGS_LABELS = [
|
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() {
|
_renderAnalyticsControl: function() {
|
||||||
return <div>
|
return <div>
|
||||||
<h3>{ _t('Analytics') }</h3>
|
<h3>{ _t('Analytics') }</h3>
|
||||||
<div className="mx_UserSettings_section">
|
<div className="mx_UserSettings_section">
|
||||||
{_t('Riot collects anonymous analytics to allow us to improve the application.')}
|
{_t('Riot collects anonymous analytics to allow us to improve the application.')}
|
||||||
<div className="mx_UserSettings_toggle">
|
{ANALYTICS_SETTINGS_LABELS.map( this._renderLocalSetting )}
|
||||||
<input id="analyticsOptOut"
|
|
||||||
type="checkbox"
|
|
||||||
defaultChecked={this._syncedSettings.analyticsOptOut}
|
|
||||||
onChange={this._onAnalyticsOptOut}
|
|
||||||
/>
|
|
||||||
<label htmlFor="analyticsOptOut">
|
|
||||||
{ _t('Opt out of analytics') }
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue