1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Create confirm download dialog

This commit is contained in:
Gonçalo Santos
2020-05-14 21:05:51 +01:00
committed by Junyoung Choi
parent 18d65d999a
commit 553832bdfa
2 changed files with 30 additions and 17 deletions

View File

@@ -23,13 +23,22 @@ class InfoTab extends React.Component {
}
}
componentDidMount() {
const { autoUpdateEnabled, amaEnabled } = ConfigManager.get()
this.setState({ config: { autoUpdateEnabled, amaEnabled } })
}
handleLinkClick(e) {
shell.openExternal(e.currentTarget.href)
e.preventDefault()
}
handleConfigChange(e) {
const newConfig = { amaEnabled: this.refs.amaEnabled.checked }
const newConfig = {
amaEnabled: this.refs.amaEnabled.checked,
autoUpdateEnabled: this.refs.autoUpdateEnabled.checked
}
this.setState({ config: newConfig })
}
@@ -77,9 +86,7 @@ class InfoTab extends React.Component {
}
handleSaveButtonClick(e) {
const newConfig = {
amaEnabled: this.state.config.amaEnabled
}
const newConfig = this.state.config
if (!newConfig.amaEnabled) {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('DISABLE_AMA')
@@ -106,15 +113,6 @@ class InfoTab extends React.Component {
})
}
toggleAutoUpdate() {
const newConfig = {
autoUpdateEnabled: !this.state.config.autoUpdateEnabled
}
this.setState({ config: newConfig })
ConfigManager.set(newConfig)
}
infoMessage() {
const { amaMessage } = this.state
return amaMessage ? <p styleName='policy-confirm'>{amaMessage}</p> : null
@@ -260,7 +258,8 @@ class InfoTab extends React.Component {
<label>
<input
type='checkbox'
onChange={this.toggleAutoUpdate.bind(this)}
ref='autoUpdateEnabled'
onChange={() => this.handleConfigChange()}
checked={this.state.config.autoUpdateEnabled}
/>
{i18n.__('Enable Auto Update')}