Skip to content

Commit

Permalink
chore: Only initialize bugsnag if reporting is enabled (#2339)
Browse files Browse the repository at this point in the history
* chore: Only initialize bugsnag if reporting is enabled
  • Loading branch information
jeanfbrito authored Mar 17, 2022
1 parent 61c02e7 commit c6da6dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ const listenToBugsnagEnabledToggle = async (appType: AppType) => {
throw new Error('app version was not set');
}

const bugsnagInstance = initBugsnag(apiKey, appVersion, appType);
let bugsnagInstance: ReturnType<typeof initBugsnag>;

if (isReportEnabled) {
bugsnagInstance = initBugsnag(apiKey, appVersion, appType);
bugsnagInstance.startSession();
}

isReportEnabled && bugsnagInstance.startSession();
listen(SETTINGS_SET_REPORT_OPT_IN_CHANGED, async (action) => {
const isReportEnabled = action.payload;

if (isReportEnabled) {
bugsnagInstance =
bugsnagInstance || initBugsnag(apiKey, appVersion, appType);
bugsnagInstance.startSession();
} else {
bugsnagInstance.pauseSession();
bugsnagInstance && bugsnagInstance.pauseSession();
}
});
};
Expand Down
4 changes: 0 additions & 4 deletions src/ui/main/menuBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,6 @@ const createViewMenu = createSelector(
? getWebContentsByServerUrl(currentView.url)
: null;
guestWebContents?.toggleDevTools();
// const windows = BrowserWindow.getAllWindows();
// windows.forEach((window) => {
// window.webContents.toggleDevTools();
// });
},
},
{
Expand Down

0 comments on commit c6da6dc

Please sign in to comment.