Skip to content

Commit

Permalink
add dialog box
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Jul 9, 2023
1 parent 7fd82d0 commit d27c8f9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/

import { app, BrowserWindow, BrowserWindowConstructorOptions, Menu, Tray } from "electron";
import { app, BrowserWindow, BrowserWindowConstructorOptions, dialog, Menu, Tray } from "electron";
import { join } from "path";
import { IpcEvents } from "shared/IpcEvents";
import { once } from "shared/utils/once";
Expand Down Expand Up @@ -126,11 +126,23 @@ function initMenuBar(win: BrowserWindow) {
toolTip: "Vencord Desktop will automatically restart after this operation"
},
{
label: "Clear data",
label: "Clear web storage",
async click() {
const { response } = await dialog.showMessageBox(win, {
message: "Are you sure you want to clear all web storage?",
detail: "Vencord Desktop will automatically restart after this operation",
buttons: ["Yes", "No"],
cancelId: 1,
defaultId: 0,
type: "warning"
});

if (response === 1) return;

await win.webContents.session.clearStorageData();
await win.webContents.session.clearCache();
await win.webContents.session.clearCodeCaches({});

app.relaunch();
app.quit();
},
Expand Down

0 comments on commit d27c8f9

Please sign in to comment.