diff --git a/src/BasePlatform.js b/src/BasePlatform.js index 7e5242b1fd..ca87535a86 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -75,7 +75,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!"); } @@ -84,10 +84,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 725139de64..101ec2c378 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -217,6 +217,13 @@ module.exports = React.createClass({ this._localSettings = UserSettingsStore.getLocalSettings(); + if (PlatformPeg.get().isElectron()) { + const {ipcRenderer} = require('electron'); + + ipcRenderer.on('settings', this._electronSettings); + ipcRenderer.send('settings_get'); + } + this.setState({ language: languageHandler.getCurrentLanguage(), }); @@ -239,6 +246,15 @@ module.exports = React.createClass({ if (cli) { cli.removeListener("RoomMember.membership", this._onInviteStateChange); } + + if (PlatformPeg.get().isElectron()) { + const {ipcRenderer} = require('electron'); + ipcRenderer.removeListener('settings', this._electronSettings); + } + }, + + _electronSettings: function(ev, settings) { + this.setState({ electron_settings: settings }); }, _refreshFromServer: function() { @@ -843,6 +859,29 @@ module.exports = React.createClass({ ; }, + _renderElectronSettings: function() { + const settings = this.state.electron_settings; + if (!settings) return; + + const {ipcRenderer} = require('electron'); + + return
+

{ _t('Desktop specific') }

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

{ _t("Advanced") }

diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 0dc634d466..36b9486cd0 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -674,6 +674,9 @@ "%(oneUser)schanged their avatar %(repeats)s times": "%(oneUser)schanged their avatar %(repeats)s times", "%(severalUsers)schanged their avatar": "%(severalUsers)schanged their avatar", "%(oneUser)schanged their avatar": "%(oneUser)schanged their avatar", + "Please select the destination room for this message": "Please select the destination room for this message", + "Start automatically after system login": "Start automatically after system login", + "Desktop specific": "Desktop specific", "Analytics": "Analytics", "Opt out of analytics": "Opt out of analytics", "Riot collects anonymous analytics to allow us to improve the application.": "Riot collects anonymous analytics to allow us to improve the application.",