first implementation for flash notification and settings to configure these
This commit is contained in:
@@ -49,7 +49,10 @@ var SettingsPage = React.createClass({
|
||||
showTrayIcon: this.state.showTrayIcon,
|
||||
trayIconTheme: this.state.trayIconTheme,
|
||||
disablewebsecurity: this.state.disablewebsecurity,
|
||||
version: settings.version
|
||||
version: settings.version,
|
||||
notifications: {
|
||||
flashWindow: this.state.notifications.flashWindow
|
||||
}
|
||||
};
|
||||
settings.writeFileSync(this.props.configFile, config);
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
@@ -96,6 +99,13 @@ var SettingsPage = React.createClass({
|
||||
});
|
||||
}
|
||||
},
|
||||
handleFlashWindowSetting: function(item) {
|
||||
this.setState({
|
||||
notifications: {
|
||||
flashWindow: item.state
|
||||
}
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
|
||||
var buttonStyle = {
|
||||
@@ -136,6 +146,40 @@ var SettingsPage = React.createClass({
|
||||
</Row>
|
||||
) : null;
|
||||
|
||||
var notificationSettings = [
|
||||
{
|
||||
label: 'Never',
|
||||
state: 0
|
||||
},
|
||||
{
|
||||
label: 'Only when idle (after 10 seconds)',
|
||||
state: 1
|
||||
},
|
||||
{
|
||||
label: 'Always',
|
||||
state: 2
|
||||
}
|
||||
];
|
||||
|
||||
var that = this;
|
||||
var notificationElements = notificationSettings.map(function(item) {
|
||||
var boundClick = that.handleFlashWindowSetting.bind(that, item);
|
||||
return (
|
||||
<Input key={ "flashWindow" + item.state } name="handleFlashWindow" ref={ "flashWindow" + item.state } type="radio"
|
||||
label={ item.label } value={ item.state } onChange={ boundClick }
|
||||
checked={ that.state.notifications.flashWindow == item.state ? "checked" : "" }/>
|
||||
);
|
||||
});
|
||||
|
||||
var notifications = (
|
||||
<Row>
|
||||
<Col md={ 12 }>
|
||||
<h2>Notifications</h2>
|
||||
{ notificationElements }
|
||||
</Col>
|
||||
</Row>
|
||||
)
|
||||
|
||||
return (
|
||||
<Grid className="settingsPage">
|
||||
<Row>
|
||||
@@ -150,6 +194,10 @@ var SettingsPage = React.createClass({
|
||||
</Row>
|
||||
{ teams_row }
|
||||
{ options_row }
|
||||
{ notifications }
|
||||
<div>
|
||||
<hr />
|
||||
</div>
|
||||
<Row>
|
||||
<Col md={ 12 }>
|
||||
<Button id="btnCancel" onClick={ this.handleCancel }>Cancel</Button>
|
||||
|
@@ -26,7 +26,10 @@ var loadDefault = function(version) {
|
||||
showTrayIcon: false,
|
||||
trayIconTheme: '',
|
||||
disablewebsecurity: true,
|
||||
version: 1
|
||||
version: 1,
|
||||
notifications: {
|
||||
flashWindow: 0 // 0 = flash never, 1 = only when idle (after 10 seconds), 2 = always
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -189,6 +189,10 @@ app.on('ready', function() {
|
||||
title: arg.title,
|
||||
content: arg.options.body
|
||||
});
|
||||
|
||||
if (config.notifications.flashWindow == 2) {
|
||||
mainWindow.flashFrame(true);
|
||||
}
|
||||
});
|
||||
|
||||
// Set overlay icon from dataURL
|
||||
@@ -209,6 +213,7 @@ app.on('ready', function() {
|
||||
}
|
||||
else {
|
||||
trayIcon.setImage(trayImages.normal);
|
||||
mainWindow.flashFrame(false);
|
||||
trayIcon.setToolTip(app.getName());
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user