@@ -11,16 +11,16 @@ const connectionManager = require('../connectionManager');
11
11
12
12
let _Menus_onSpellCheckerLanguageChanged = new WeakMap ( ) ;
13
13
class Menus {
14
- constructor ( window , config , iconPath ) {
14
+ constructor ( window , configGroup , iconPath ) {
15
15
/**
16
16
* @type {Electron.BrowserWindow }
17
17
*/
18
18
this . window = window ;
19
19
this . iconPath = iconPath ;
20
- this . config = config ;
20
+ this . configGroup = configGroup ;
21
21
this . allowQuit = false ;
22
22
this . logger = new LucidLog ( {
23
- levels : config . appLogLevels . split ( ',' )
23
+ levels : configGroup . startupConfig . appLogLevels . split ( ',' )
24
24
} ) ;
25
25
this . initialize ( ) ;
26
26
}
@@ -55,7 +55,7 @@ class Menus {
55
55
} ) === 0 ;
56
56
57
57
if ( clearStorage ) {
58
- const defSession = session . fromPartition ( this . config . partition ) ;
58
+ const defSession = session . fromPartition ( this . configGroup . startupConfig . partition ) ;
59
59
await defSession . clearStorageData ( ) ;
60
60
}
61
61
@@ -108,7 +108,7 @@ class Menus {
108
108
initialize ( ) {
109
109
const appMenu = application ( this ) ;
110
110
111
- if ( this . config . menubar == 'hidden' ) {
111
+ if ( this . configGroup . startupConfig . menubar == 'hidden' ) {
112
112
this . window . removeMenu ( ) ;
113
113
} else {
114
114
this . window . setMenu ( Menu . buildFromTemplate ( [
@@ -120,7 +120,7 @@ class Menus {
120
120
121
121
this . initializeEventHandlers ( ) ;
122
122
123
- this . tray = new Tray ( this . window , appMenu . submenu , this . iconPath , this . config ) ;
123
+ this . tray = new Tray ( this . window , appMenu . submenu , this . iconPath , this . configGroup . startupConfig ) ;
124
124
this . spellCheckProvider = new SpellCheckProvider ( this . window , this . logger ) ;
125
125
}
126
126
@@ -137,7 +137,7 @@ class Menus {
137
137
138
138
onClose ( event ) {
139
139
this . logger . debug ( 'window close' ) ;
140
- if ( ! this . allowQuit && ! this . config . closeAppOnCross ) {
140
+ if ( ! this . allowQuit && ! this . configGroup . startupConfig . closeAppOnCross ) {
141
141
event . preventDefault ( ) ;
142
142
this . hide ( ) ;
143
143
} else {
@@ -155,6 +155,42 @@ class Menus {
155
155
ipcMain . once ( 'set-teams-settings' , restoreSettingsInternal ) ;
156
156
this . window . webContents . send ( 'set-teams-settings' , JSON . parse ( fs . readFileSync ( path . join ( app . getPath ( 'userData' ) , 'teams_settings.json' ) ) ) ) ;
157
157
}
158
+
159
+ updateMenu ( ) {
160
+ const appMenu = application ( this ) ;
161
+ this . window . setMenu ( Menu . buildFromTemplate ( [
162
+ appMenu ,
163
+ preferences ( ) ,
164
+ help ( app , this . window ) ,
165
+ ] ) ) ;
166
+ this . tray . setContextMenu ( appMenu . submenu ) ;
167
+ }
168
+
169
+ toggleDisableNotifications ( ) {
170
+ this . configGroup . startupConfig . disableNotifications = ! this . configGroup . startupConfig . disableNotifications
171
+ this . configGroup . legacyConfigStore . set ( 'disableNotifications' , this . configGroup . startupConfig . disableNotifications ) ;
172
+ this . updateMenu ( ) ;
173
+ }
174
+ toggleDisableMeetingNotifications ( ) {
175
+ this . configGroup . startupConfig . disableMeetingNotifications = ! this . configGroup . startupConfig . disableMeetingNotifications
176
+ this . configGroup . legacyConfigStore . set ( 'disableMeetingNotifications' , this . configGroup . startupConfig . disableMeetingNotifications ) ;
177
+ this . updateMenu ( ) ;
178
+ }
179
+ toggleDisableNotificationSound ( ) {
180
+ this . configGroup . startupConfig . disableNotificationSound = ! this . configGroup . startupConfig . disableNotificationSound
181
+ this . configGroup . legacyConfigStore . set ( 'disableNotificationSound' , this . configGroup . startupConfig . disableNotificationSound ) ;
182
+ this . updateMenu ( ) ;
183
+ }
184
+ toggleDisableNotificationSoundIfNotAvailable ( ) {
185
+ this . configGroup . startupConfig . disableNotificationSoundIfNotAvailable = ! this . configGroup . startupConfig . disableNotificationSoundIfNotAvailable
186
+ this . configGroup . legacyConfigStore . set ( 'disableNotificationSoundIfNotAvailable' , this . configGroup . startupConfig . disableNotificationSoundIfNotAvailable ) ;
187
+ this . updateMenu ( ) ;
188
+ }
189
+ toggleDisableNotificationWindowFlash ( ) {
190
+ this . configGroup . startupConfig . disableNotificationWindowFlash = ! this . configGroup . startupConfig . disableNotificationWindowFlash
191
+ this . configGroup . legacyConfigStore . set ( 'disableNotificationWindowFlash' , this . configGroup . startupConfig . disableNotificationWindowFlash ) ;
192
+ this . updateMenu ( ) ;
193
+ }
158
194
}
159
195
160
196
function saveSettingsInternal ( event , arg ) {
0 commit comments