Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Save user preference for crashes after confirmation dialog #417

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/config/comfySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,4 @@ export class ComfySettings {
get<K extends keyof ComfySettingsData>(key: K): ComfySettingsData[K] {
return this.settings[key] ?? DEFAULT_SETTINGS[key];
}

set<K extends keyof ComfySettingsData>(key: K, value: ComfySettingsData[K]) {
this.settings[key] = value;
}
}
2 changes: 1 addition & 1 deletion src/main-process/appWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getAppResourcesPath } from '../install/resourcePaths';
*/
export class AppWindow {
private window: BrowserWindow;
private store: Store<StoreType>;
public store: Store<StoreType>;
private messageQueue: Array<{ channel: string; data: any }> = [];
private rendererReady: boolean = false;

Expand Down
13 changes: 10 additions & 3 deletions src/services/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ class SentryLogging {
beforeSend: async (event) => {
this.filterEvent(event);

const alwaysSendCrashReports = this.comfyDesktopApp?.appWindow?.store?.get('alwaysSendCrashReports', false);

if (
event.extra?.comfyUIExecutionError ||
this.comfyDesktopApp?.comfySettings.get('Comfy-Desktop.SendStatistics')
this.comfyDesktopApp?.comfySettings.get('Comfy-Desktop.SendStatistics') ||
alwaysSendCrashReports
) {
return event;
}
Expand All @@ -28,11 +31,15 @@ class SentryLogging {
title: 'Send Crash Report',
message: `An error occurred: ${errorType}`,
detail: `${errorMessage}\n\nWould you like to send the crash to the team?`,
buttons: ['Send Report', 'Do not send crash report'],
buttons: ['Send Report', 'Always send crash reports', 'Do not send crash report'],
type: 'error',
});

return response === 0 ? event : null;
if (response === 1) {
this.comfyDesktopApp?.appWindow?.store?.set('alwaysSendCrashReports', true);
}

return response !== 2 ? event : null;
},
integrations: [
Sentry.childProcessIntegration({
Expand Down
1 change: 1 addition & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export type StoreType = {
windowX: number | undefined;
windowY: number | undefined;
windowMaximized?: boolean;
alwaysSendCrashReports?: boolean;
};
Loading