Skip to content

Commit 362bdd8

Browse files
committed
Fix: #1146
1 parent 092a7b2 commit 362bdd8

File tree

7 files changed

+91
-29
lines changed

7 files changed

+91
-29
lines changed

app/mainAppWindow/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ let window = null;
5656
let appConfig = null;
5757

5858
/**
59-
* @param {AppConfiguration} mainConfig
59+
* @param {AppConfiguration} configGroup
6060
*/
61-
exports.onAppReady = async function onAppReady(mainConfig) {
62-
appConfig = mainConfig;
63-
config = mainConfig.startupConfig;
64-
iconChooser = new TrayIconChooser(mainConfig.startupConfig);
61+
exports.onAppReady = async function onAppReady(configGroup) {
62+
appConfig = configGroup;
63+
config = configGroup.startupConfig;
64+
iconChooser = new TrayIconChooser(configGroup.startupConfig);
6565
logger = new LucidLog({
6666
levels: config.appLogLevels.split(',')
6767
});
6868

6969
window = await createWindow();
7070

71-
const m = new Menus(window, config, iconChooser.getFile());
71+
const m = new Menus(window, configGroup, iconChooser.getFile());
7272
m.onSpellCheckerLanguageChanged = onSpellCheckerLanguageChanged;
7373

7474
addEventHandlers();

app/menus/application.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,32 @@ function getNotificationsMenu(Menus) {
8080
{
8181
label: 'Disable All Notifications',
8282
type: 'checkbox',
83-
checked: Menus.config.disableNotifications,
84-
click: () => Menus.config.disableNotifications = !Menus.config.disableNotifications
83+
checked: Menus.configGroup.startupConfig.disableNotifications,
84+
click: () => Menus.toggleDisableNotifications()
8585
},
8686
{
8787
label: 'Disable Meeting Notifications',
8888
type: 'checkbox',
89-
checked: Menus.config.disableMeetingNotifications,
90-
click: () => Menus.config.disableMeetingNotifications = !Menus.config.disableMeetingNotifications
89+
checked: Menus.configGroup.startupConfig.disableMeetingNotifications,
90+
click: () => Menus.toggleDisableMeetingNotifications()
9191
},
9292
{
9393
label: 'Disable Notifications Sound',
9494
type: 'checkbox',
95-
checked: Menus.config.disableNotificationSound,
96-
click: () => Menus.config.disableNotificationSound = !Menus.config.disableNotificationSound
95+
checked: Menus.configGroup.startupConfig.disableNotificationSound,
96+
click: () => Menus.toggleDisableNotificationSound()
9797
},
9898
{
9999
label: 'Disable Sound when Not Available (e.g: busy, in a call)',
100100
type: 'checkbox',
101-
checked: Menus.config.disableNotificationSoundIfNotAvailable,
102-
click: () => Menus.config.disableNotificationSoundIfNotAvailable = !Menus.config.disableNotificationSoundIfNotAvailable
101+
checked: Menus.configGroup.startupConfig.disableNotificationSoundIfNotAvailable,
102+
click: () => Menus.toggleDisableNotificationSoundIfNotAvailable()
103103
},
104104
{
105105
label: 'Disables Window Flash on New Notifications',
106106
type: 'checkbox',
107-
checked: Menus.config.disableNotificationWindowFlash,
108-
click: () => Menus.config.disableNotificationWindowFlash = !Menus.config.disableNotificationWindowFlash
107+
checked: Menus.configGroup.startupConfig.disableNotificationWindowFlash,
108+
click: () => Menus.toggleDisableNotificationWindowFlash()
109109
}
110110
]
111111
};

app/menus/index.js

+43-7
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ const connectionManager = require('../connectionManager');
1111

1212
let _Menus_onSpellCheckerLanguageChanged = new WeakMap();
1313
class Menus {
14-
constructor(window, config, iconPath) {
14+
constructor(window, configGroup, iconPath) {
1515
/**
1616
* @type {Electron.BrowserWindow}
1717
*/
1818
this.window = window;
1919
this.iconPath = iconPath;
20-
this.config = config;
20+
this.configGroup = configGroup;
2121
this.allowQuit = false;
2222
this.logger = new LucidLog({
23-
levels: config.appLogLevels.split(',')
23+
levels: configGroup.startupConfig.appLogLevels.split(',')
2424
});
2525
this.initialize();
2626
}
@@ -55,7 +55,7 @@ class Menus {
5555
}) === 0;
5656

5757
if (clearStorage) {
58-
const defSession = session.fromPartition(this.config.partition);
58+
const defSession = session.fromPartition(this.configGroup.startupConfig.partition);
5959
await defSession.clearStorageData();
6060
}
6161

@@ -108,7 +108,7 @@ class Menus {
108108
initialize() {
109109
const appMenu = application(this);
110110

111-
if (this.config.menubar == 'hidden') {
111+
if (this.configGroup.startupConfig.menubar == 'hidden') {
112112
this.window.removeMenu();
113113
} else {
114114
this.window.setMenu(Menu.buildFromTemplate([
@@ -120,7 +120,7 @@ class Menus {
120120

121121
this.initializeEventHandlers();
122122

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);
124124
this.spellCheckProvider = new SpellCheckProvider(this.window, this.logger);
125125
}
126126

@@ -137,7 +137,7 @@ class Menus {
137137

138138
onClose(event) {
139139
this.logger.debug('window close');
140-
if (!this.allowQuit && !this.config.closeAppOnCross) {
140+
if (!this.allowQuit && !this.configGroup.startupConfig.closeAppOnCross) {
141141
event.preventDefault();
142142
this.hide();
143143
} else {
@@ -155,6 +155,42 @@ class Menus {
155155
ipcMain.once('set-teams-settings', restoreSettingsInternal);
156156
this.window.webContents.send('set-teams-settings', JSON.parse(fs.readFileSync(path.join(app.getPath('userData'), 'teams_settings.json'))));
157157
}
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+
}
158194
}
159195

160196
function saveSettingsInternal(event, arg) {

app/menus/tray.js

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class ApplicationTray {
1818
ipcMain.on('tray-update', (event, { icon, flash }) => this.updateTrayImage(icon, flash));
1919
}
2020

21+
setContextMenu(appMenu) {
22+
this.tray.setContextMenu(Menu.buildFromTemplate(appMenu));
23+
}
24+
2125
showAndFocusWindow() {
2226
this.window.show();
2327
this.window.focus();

com.github.IsmaelMartinez.teams_for_linux.appdata.xml

+22
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,28 @@
1414
<url type="bugtracker">https://github.com/IsmaelMartinez/teams-for-linux/issues</url>
1515
<launchable type="desktop-id">com.github.IsmaelMartinez.teams_for_linux.desktop</launchable>
1616
<releases>
17+
<release version="1.4.22" date="2024-04-12">
18+
<description>
19+
<ul>
20+
<li>Electron version upgraded to 29.3.0</li>
21+
<li>Fix: Teams doesn't remember the setting disable notification sound</li>
22+
</ul>
23+
</description>
24+
</release>
25+
<release version="1.4.21" date="2024-04-07">
26+
<description>
27+
<ul>
28+
<li>Electron version upgraded to 29.2.0</li>
29+
</ul>
30+
</description>
31+
</release>
32+
<release version="1.4.20" date="2024-04-06">
33+
<description>
34+
<ul>
35+
<li>Now the notification badge count clears when all are read</li>
36+
</ul>
37+
</description>
38+
</release>
1739
<release version="1.4.19" date="2024-04-05">
1840
<description>
1941
<ul>

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "teams-for-linux",
3-
"version": "1.4.21",
3+
"version": "1.4.22",
44
"main": "app/index.js",
55
"description": "Unofficial client for Microsoft Teams for Linux",
66
"homepage": "https://github.com/IsmaelMartinez/teams-for-linux",
@@ -49,7 +49,7 @@
4949
},
5050
"devDependencies": {
5151
"@electron/fuses": "^1.7.0",
52-
"electron": "29.2.0",
52+
"electron": "29.3.0",
5353
"electron-builder": "24.13.3",
5454
"eslint": "9.0.0",
5555
"yarn": "1.22.22"

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,10 @@ [email protected]:
863863
jsonfile "^4.0.0"
864864
mkdirp "^0.5.1"
865865

866-
electron@29.2.0:
867-
version "29.2.0"
868-
resolved "https://registry.yarnpkg.com/electron/-/electron-29.2.0.tgz#98e9d45dcebda124fb0bd1ff20fc509ec692101c"
869-
integrity sha512-ALKrCN52RG4g9prx4DriXSPnY5WoiyRUCNp7zEVQuoiNOpHTNqMMpRidQAHzntV4hajF1LMWHVoBkwqIs1jHhg==
866+
electron@29.3.0:
867+
version "29.3.0"
868+
resolved "https://registry.yarnpkg.com/electron/-/electron-29.3.0.tgz#8e65cb08e9c0952c66d3196e1b5c811c43b8c5b0"
869+
integrity sha512-ZxFKm0/v48GSoBuO3DdnMlCYXefEUKUHLMsKxyXY4nZGgzbBKpF/X8haZa2paNj23CLfsCKBOtfc2vsEQiOOsA==
870870
dependencies:
871871
"@electron/get" "^2.0.0"
872872
"@types/node" "^20.9.0"

0 commit comments

Comments
 (0)