import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './InfoTab.styl' import ConfigManager from 'browser/main/lib/ConfigManager' import store from 'browser/main/store' import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig' import _ from 'lodash' const electron = require('electron') const { shell, remote } = electron const appVersion = remote.app.getVersion() class InfoTab extends React.Component { constructor (props) { super(props) this.state = { config: this.props.config } } handleLinkClick (e) { shell.openExternal(e.currentTarget.href) e.preventDefault() } handleConfigChange (e) { const newConfig = { amaEnabled: this.refs.amaEnabled.checked } this.setState({ config: newConfig }) } handleSaveButtonClick (e) { const newConfig = { amaEnabled: this.state.config.amaEnabled } if (!newConfig.amaEnabled) { AwsMobileAnalyticsConfig.recordDynamicCustomEvent('DISABLE_AMA') this.setState({ amaMessage: 'We hope we will gain your trust' }) } else { this.setState({ amaMessage: 'Thanks for trusting us' }) } _.debounce(() => { this.setState({ amaMessage: '' }) }, 3000)() ConfigManager.set(newConfig) store.dispatch({ type: 'SET_CONFIG', config: newConfig }) } infoMessage () { const { amaMessage } = this.state return amaMessage ?

{amaMessage}

: null } render () { return (
Community

About
Boostnote {appVersion}
An open source note-taking app made for programmers just like you.

Analytics
Boostnote collects anonymous data for the sole purpose of improving the application, and strictly does not collect any personal information such the contents of your notes.
You can see how it works on this.handleLinkClick(e)}>GitHub.

You can choose to enable or disable this option.
this.handleConfigChange(e)} checked={this.state.config.amaEnabled} ref='amaEnabled' type='checkbox' /> Enable analytics to help improve Boostnote

{this.infoMessage()}
) } } InfoTab.propTypes = { } export default CSSModules(InfoTab, styles)