mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-22 08:57:00 -06:00
Merge pull request #1258 from johankwarnmarksymphony/sda3312
fix: Clean up after new locale is set
This commit is contained in:
commit
7abf2531c8
@ -32,6 +32,7 @@ import { screenSnippet } from './screen-snippet-handler';
|
||||
import { updateAlwaysOnTop } from './window-actions';
|
||||
import { ICustomBrowserWindow, windowHandler } from './window-handler';
|
||||
|
||||
import { notification } from '../renderer/notification';
|
||||
interface IStyles {
|
||||
name: styleNames;
|
||||
content: string;
|
||||
@ -293,6 +294,9 @@ export const updateLocale = async (locale: LocaleType): Promise<void> => {
|
||||
appMenu.update(locale);
|
||||
}
|
||||
|
||||
// Update notification after new locale
|
||||
notification.cleanUpInactiveNotification();
|
||||
|
||||
if (i18n.isValidLocale(locale)) {
|
||||
// Update user config file with latest locale changes
|
||||
await config.updateUserConfig({ locale });
|
||||
|
@ -427,6 +427,25 @@ class Notification extends NotificationHandler {
|
||||
this.inactiveWindows = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the active notification after certain period
|
||||
*/
|
||||
public cleanUpInactiveNotification() {
|
||||
if (this.inactiveWindows.length > 0) {
|
||||
logger.info('notification: cleaning up inactive notification windows', {
|
||||
inactiveNotification: this.inactiveWindows.length,
|
||||
});
|
||||
this.inactiveWindows.forEach((window) => {
|
||||
if (windowExists(window)) {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
logger.info(`notification: cleaned up inactive notification windows`, {
|
||||
inactiveNotification: this.inactiveWindows.length,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Brings all the notification to the top
|
||||
* issue: ELECTRON-1382
|
||||
@ -508,25 +527,6 @@ class Notification extends NotificationHandler {
|
||||
this.activeNotifications.push(notificationWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the active notification after certain period
|
||||
*/
|
||||
private cleanUpInactiveNotification() {
|
||||
if (this.inactiveWindows.length > 0) {
|
||||
logger.info('notification: cleaning up inactive notification windows', {
|
||||
inactiveNotification: this.inactiveWindows.length,
|
||||
});
|
||||
this.inactiveWindows.forEach((window) => {
|
||||
if (windowExists(window)) {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
logger.info(`notification: cleaned up inactive notification windows`, {
|
||||
inactiveNotification: this.inactiveWindows.length,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the timer for a specific notification window
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user