diff --git a/src/BasePlatform.js b/src/BasePlatform.js index 6eed22f436..0fa377c88e 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -70,7 +70,7 @@ export default class BasePlatform { * Returns a promise that resolves to a string representing * the current version of the application. */ - getAppVersion() { + getAppVersion(): Promise { throw new Error("getAppVersion not implemented!"); } @@ -79,10 +79,12 @@ export default class BasePlatform { * with getUserMedia, return a string explaining why not. * Otherwise, return null. */ - screenCaptureErrorString() { + screenCaptureErrorString(): string { return "Not implemented"; } + isElectron(): boolean { return false; } + /** * Restarts the application, without neccessarily reloading * any application code diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 2d76047d33..0407c9b43a 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -197,6 +197,16 @@ module.exports = React.createClass({ this._syncedSettings = syncedSettings; this._localSettings = UserSettingsStore.getLocalSettings(); + + if (PlatformPeg.get().isElectron()) { + const {ipcRenderer} = require('electron'); + + ipcRenderer.once('settings', (ev, settings) => { + this.setState({ electron_settings: settings }); + }); + + ipcRenderer.send('settings_get'); + } }, componentDidMount: function() { @@ -787,6 +797,29 @@ module.exports = React.createClass({ ; }, + _renderElectronSettings: function() { + const settings = this.state.electron_settings; + if (!settings) return; + + const {ipcRenderer} = require('electron'); + + return
+

Electron Settings

+
+
+ { + ipcRenderer.send('settings_set', 'auto-launch', e.target.checked); + }} + /> + +
+
+
; + }, + _showSpoiler: function(event) { const target = event.target; target.innerHTML = target.getAttribute('data-spoiler'); @@ -988,6 +1021,8 @@ module.exports = React.createClass({ {this._renderBulkOptions()} {this._renderBugReport()} + {PlatformPeg.get().isElectron() && this._renderElectronSettings()} +

Advanced