diff --git a/src/app/browser/preferences/index.tsx b/src/app/browser/preferences/index.tsx
index 3777e31..b84e2be 100644
--- a/src/app/browser/preferences/index.tsx
+++ b/src/app/browser/preferences/index.tsx
@@ -30,6 +30,8 @@ function _Preferences(props: {
const [login_item, ,, forceRefreshLoginItem] = useAsync(useCallback(() => ipc.getLoginItemSettings(), [ipc]));
+ const [show_error_alerts, , show_error_alerts_state, forceRefreshErrorAlerts] = useAsync(useCallback(() => ipc.getShowErrorAlerts(), [ipc]));
+
const setOpenAtLogin = useCallback(async (open_at_login: boolean | 'mixed') => {
await ipc.setLoginItemSettings({...login_item!, startup_enabled: !!open_at_login});
forceRefreshLoginItem();
@@ -39,6 +41,11 @@ function _Preferences(props: {
forceRefreshLoginItem();
}, [ipc, login_item]);
+ const setShowErrorAlerts = useCallback(async (show_error_alerts: boolean | 'mixed') => {
+ await ipc.setShowErrorAlerts(!!show_error_alerts);
+ forceRefreshErrorAlerts();
+ }, [ipc]);
+
const [discord_users, discord_users_error, discord_users_state, forceRefreshDiscordUsers] =
useAsync(useCallback(() => ipc.getDiscordUsers(), [ipc]));
@@ -97,7 +104,8 @@ function _Preferences(props: {
useEventListener(events, 'window:refresh', () => (
forceRefreshAccounts(), forceRefreshLoginItem(),
- forceRefreshDiscordUsers(), forceRefreshDiscordOptions()
+ forceRefreshDiscordUsers(), forceRefreshDiscordOptions(),
+ forceRefreshErrorAlerts()
), []);
if (!users ||
@@ -280,6 +288,26 @@ function _Preferences(props: {
{t('splatnet3.discord_help_2')}
+
+
+
+ {t('miscellaneous.heading')}
+
+
+
+
+ setShowErrorAlerts(!(show_error_alerts ?? true))}>
+ {t('miscellaneous.show_error_alerts')}
+
+
+ {t('miscellaneous.show_error_alerts_help')}
+
+
;
}
diff --git a/src/app/i18n/locale/en-gb.ts b/src/app/i18n/locale/en-gb.ts
index 395e5b4..ed8b37c 100644
--- a/src/app/i18n/locale/en-gb.ts
+++ b/src/app/i18n/locale/en-gb.ts
@@ -290,6 +290,12 @@ export const preferences_window = {
discord_help_1: 'Uses SplatNet 3 to retrieve additional presence information while playing Splatoon 3. You must be using a secondary Nintendo Account that is friends with your main account to fetch your presence, and the secondary account must be able to access SplatNet 3.',
discord_help_2: 'When using a presence URL that returns Splatoon 3 data additional presence information will be shown regardless of this setting.',
},
+
+ miscellaneous: {
+ heading: 'Miscellaneous',
+ show_error_alerts: 'Show error alerts',
+ show_error_alerts_help: 'This will show a popup when an error occurs while loading data. This is useful for debugging, but can be annoying if you are not interested in the errors.',
+ }
};
export const friend_window = {
diff --git a/src/app/main/index.ts b/src/app/main/index.ts
index fc97795..13c7cf0 100644
--- a/src/app/main/index.ts
+++ b/src/app/main/index.ts
@@ -484,6 +484,7 @@ export class Store extends EventEmitter {
error: err,
buttons: ['OK', 'Retry'],
defaultId: 1,
+ app: this.app,
});
if (response === 1) {
@@ -513,6 +514,7 @@ export class Store extends EventEmitter {
error: err,
buttons: ['OK', 'Retry'],
defaultId: 1,
+ app: this.app,
});
if (response === 1) {
@@ -520,4 +522,4 @@ export class Store extends EventEmitter {
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/app/main/ipc.ts b/src/app/main/ipc.ts
index f5e0634..7b5a5be 100644
--- a/src/app/main/ipc.ts
+++ b/src/app/main/ipc.ts
@@ -64,6 +64,10 @@ export function setupIpc(appinstance: App, ipcMain: IpcMain) {
handle('systemPreferences:getloginitem', () => appinstance.store.getLoginItem());
handle('systemPreferences:setloginitem', (e, settings: LoginItemOptions) => appinstance.store.setLoginItem(settings));
+ handle('preferences:showerroralerts', () => storage.getItem('preferences.showerroralerts'));
+ handle('preferences:setshowerroralerts', (e, enabled: boolean) =>
+ storage.setItem('preferences.showerroralerts', enabled));
+
handle('update:get', () => appinstance.updater.cache ?? appinstance.updater.check());
handle('update:check', () => appinstance.updater.check());
diff --git a/src/app/main/monitor.ts b/src/app/main/monitor.ts
index 1772c57..ff9323e 100644
--- a/src/app/main/monitor.ts
+++ b/src/app/main/monitor.ts
@@ -63,6 +63,7 @@ export class PresenceMonitorManager {
error: err,
buttons: ['OK', 'Retry', 'Stop'],
defaultId: 0,
+ app: this.app,
});
if (response === 1) {
@@ -391,6 +392,7 @@ export class PresenceMonitorManager {
error: err,
buttons: ['OK', 'Retry'],
defaultId: 0,
+ app: this.app,
});
if (response === 1) {
@@ -420,6 +422,7 @@ export class PresenceMonitorManager {
await showErrorDialog({
message: error.name + ' updating presence monitor',
error,
+ app: this.app,
});
}
}
diff --git a/src/app/main/util.ts b/src/app/main/util.ts
index c2187de..2061726 100644
--- a/src/app/main/util.ts
+++ b/src/app/main/util.ts
@@ -77,10 +77,17 @@ interface ErrorBoxOptions extends MessageBoxOptions {
window?: BrowserWindow;
}
-export function showErrorDialog(options: ErrorBoxOptions) {
+export async function showErrorDialog(options: ErrorBoxOptions) {
const {error, app, window, ...message_box_options} = options;
const detail = ErrorDescription.getErrorDescription(error);
+ if (app) {
+ const showErrorAlerts = await app.store.storage.getItem('preferences.showerroralerts') as boolean
+ if (showErrorAlerts === false) {
+ return Promise.resolve({ response: 0, checkboxChecked: false });
+ }
+ }
+
message_box_options.detail = message_box_options.detail ?
detail + '\n\n' + message_box_options.detail :
detail;
diff --git a/src/app/preload/index.ts b/src/app/preload/index.ts
index ba3c841..360c034 100644
--- a/src/app/preload/index.ts
+++ b/src/app/preload/index.ts
@@ -47,6 +47,9 @@ const ipc = {
getLoginItemSettings: () => inv('systemPreferences:getloginitem'),
setLoginItemSettings: (settings: LoginItemOptions) => inv('systemPreferences:setloginitem', settings),
+ getShowErrorAlerts: () => inv('preferences:showerroralerts'),
+ setShowErrorAlerts: (enabled: boolean) => inv('preferences:setshowerroralerts', enabled),
+
getUpdateData: () => inv('update:get'),
checkUpdates: () => inv('update:check'),