mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Initial Electron Settings - for Auto Launch
(opens path for Proxy Settings) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
46bb29a3af
commit
1186207658
@ -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<string> {
|
||||
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
|
||||
|
@ -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({
|
||||
</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) {
|
||||
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()}
|
||||
|
||||
<h3>Advanced</h3>
|
||||
|
||||
<div className="mx_UserSettings_section">
|
||||
|
Loading…
Reference in New Issue
Block a user