File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ var SettingsPage = React.createClass({
1313 } ;
1414 } ,
1515
16- toggleParticipating : function ( event ) {
17- Actions . setSetting ( 'participating' , event . target . checked ) ;
16+ toggleSetting : function ( key , event ) {
17+ Actions . setSetting ( key , event . target . checked ) ;
1818 } ,
1919
2020 appQuit : function ( ) {
@@ -29,7 +29,15 @@ var SettingsPage = React.createClass({
2929 < div className = 'col-xs-4' >
3030 < Toggle
3131 defaultChecked = { this . state . participating }
32- onChange = { this . toggleParticipating } />
32+ onChange = { this . toggleSetting . bind ( this , 'participating' ) } />
33+ </ div >
34+ </ div >
35+ < div className = 'row' >
36+ < div className = 'col-xs-8' > Play sound</ div >
37+ < div className = 'col-xs-4' >
38+ < Toggle
39+ defaultChecked = { this . state . participating }
40+ onChange = { this . toggleSetting . bind ( this , 'play-sound' ) } />
3341 </ div >
3442 </ div >
3543 < div className = 'row' >
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ var NotificationsStore = Reflux.createStore({
4949 onGetNotifications : function ( ) {
5050 var self = this ;
5151 var participating = SettingsStore . getSettings ( ) . participating ;
52+ var playSound = SettingsStore . getSettings ( ) . playSound ;
5253
5354 apiRequests
5455 . getAuth ( 'https://api.github.com/notifications?participating=' +
@@ -58,7 +59,10 @@ var NotificationsStore = Reflux.createStore({
5859 // Success - Do Something.
5960 Actions . getNotifications . completed ( response . body ) ;
6061 self . updateTrayIcon ( response . body ) ;
61- self . isNewNotification ( response . body ) ;
62+
63+ if ( playSound ) {
64+ self . isNewNotification ( response . body ) ;
65+ }
6266 } else {
6367 // Error - Show messages.
6468 Actions . getNotifications . failed ( err ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ var SettingsStore = Reflux.createStore({
99
1010 if ( ! settings ) {
1111 settings = {
12- 'participating' : false
12+ 'participating' : false ,
13+ 'playSound' : true
1314 } ;
1415 }
1516
You can’t perform that action at this time.
0 commit comments