(mb: Menubar)
| 13 | * @param mb - The menubar instance used for the dialog parent window and quit. |
| 14 | */ |
| 15 | export function resetApp(mb: Menubar): void { |
| 16 | if (!mb.window) { |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | const cancelButtonId = 0; |
| 21 | const resetButtonId = 1; |
| 22 | |
| 23 | const response = dialog.showMessageBoxSync(mb.window, { |
| 24 | type: 'warning', |
| 25 | title: `Reset ${APPLICATION.NAME}`, |
| 26 | message: `Are you sure you want to reset ${APPLICATION.NAME}? You will be logged out of all accounts`, |
| 27 | buttons: ['Cancel', 'Reset'], |
| 28 | defaultId: cancelButtonId, |
| 29 | cancelId: cancelButtonId, |
| 30 | }); |
| 31 | |
| 32 | if (response === resetButtonId) { |
| 33 | sendRendererEvent(mb, EVENTS.RESET_APP); |
| 34 | mb.app.quit(); |
| 35 | } |
| 36 | } |
no test coverage detected