Initial Electron Settings - for Auto Launch

(opens path for Proxy Settings)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-05-24 15:40:50 +01:00
parent 46bb29a3af
commit 1186207658
2 changed files with 39 additions and 2 deletions

View File

@ -70,7 +70,7 @@ export default class BasePlatform {
* Returns a promise that resolves to a string representing * Returns a promise that resolves to a string representing
* the current version of the application. * the current version of the application.
*/ */
getAppVersion() { getAppVersion(): Promise<string> {
throw new Error("getAppVersion not implemented!"); throw new Error("getAppVersion not implemented!");
} }
@ -79,10 +79,12 @@ export default class BasePlatform {
* with getUserMedia, return a string explaining why not. * with getUserMedia, return a string explaining why not.
* Otherwise, return null. * Otherwise, return null.
*/ */
screenCaptureErrorString() { screenCaptureErrorString(): string {
return "Not implemented"; return "Not implemented";
} }
isElectron(): boolean { return false; }
/** /**
* Restarts the application, without neccessarily reloading * Restarts the application, without neccessarily reloading
* any application code * any application code

View File

@ -197,6 +197,16 @@ module.exports = React.createClass({
this._syncedSettings = syncedSettings; this._syncedSettings = syncedSettings;
this._localSettings = UserSettingsStore.getLocalSettings(); 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() { componentDidMount: function() {
@ -787,6 +797,29 @@ module.exports = React.createClass({
</div>; </div>;
}, },
_renderElectronSettings: function() {
const settings = this.state.electron_settings;
if (!settings) return;
const {ipcRenderer} = require('electron');
return <div>
<h3>Electron Settings</h3>
<div className="mx_UserSettings_section">
<div className="mx_UserSettings_toggle">
<input type="checkbox"
name="auto-launch"
defaultChecked={settings['auto-launch']}
onChange={(e) => {
ipcRenderer.send('settings_set', 'auto-launch', e.target.checked);
}}
/>
<label htmlFor="auto-launch">Start automatically after system login</label>
</div>
</div>
</div>;
},
_showSpoiler: function(event) { _showSpoiler: function(event) {
const target = event.target; const target = event.target;
target.innerHTML = target.getAttribute('data-spoiler'); target.innerHTML = target.getAttribute('data-spoiler');
@ -988,6 +1021,8 @@ module.exports = React.createClass({
{this._renderBulkOptions()} {this._renderBulkOptions()}
{this._renderBugReport()} {this._renderBugReport()}
{PlatformPeg.get().isElectron() && this._renderElectronSettings()}
<h3>Advanced</h3> <h3>Advanced</h3>
<div className="mx_UserSettings_section"> <div className="mx_UserSettings_section">