Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
RiotTranslate 2017-05-30 23:22:31 +00:00
commit 549875ba0a
3 changed files with 48 additions and 2 deletions

View file

@ -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<string> {
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

View file

@ -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({
</div>;
},
_renderElectronSettings: function() {
const settings = this.state.electron_settings;
if (!settings) return;
const {ipcRenderer} = require('electron');
return <div>
<h3>{ _t('Desktop specific') }</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">{_t('Start automatically after system login')}</label>
</div>
</div>
</div>;
},
_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()}
<h3>{ _t("Advanced") }</h3>

View file

@ -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.",