diff --git a/app/renderer/js/pages/preference/general-section.js b/app/renderer/js/pages/preference/general-section.js index 6701a291..821576a2 100644 --- a/app/renderer/js/pages/preference/general-section.js +++ b/app/renderer/js/pages/preference/general-section.js @@ -21,6 +21,13 @@ class GeneralSection extends BaseComponent {
+
App updates
+
+
+
Get Beta updates
+
+
+
`; } @@ -41,9 +48,26 @@ class GeneralSection extends BaseComponent { } } + updateOptionTemplate(updateOption) { + if (updateOption) { + return ` +
+ On +
+ `; + } else { + return ` +
+ Off +
+ `; + } + } + init() { this.props.$root.innerHTML = this.template(); this.initTrayOption(); + this.initUpdateOption(); } initTrayOption() { @@ -62,6 +86,21 @@ class GeneralSection extends BaseComponent { }); } + initUpdateOption() { + this.$updateOptionSettings = document.querySelector('#betaupdate-option-settings .setting-control'); + this.$updateOptionSettings.innerHTML = ''; + + const updateOption = ConfigUtil.getConfigItem('BetaUpdate', true); + const $updateOption = this.generateNodeFromTemplate(this.updateOptionTemplate(updateOption)); + this.$updateOptionSettings.appendChild($updateOption); + + $updateOption.addEventListener('click', () => { + const newValue = !ConfigUtil.getConfigItem('BetaUpdate'); + ConfigUtil.setConfigItem('BetaUpdate', newValue); + this.initUpdateOption(); + }); + } + handleServerInfoChange() { ipcRenderer.send('reload-main'); }