Browse Source

Forward clearElectronStore

Manav Rathi 1 year ago
parent
commit
83477cfe37
2 changed files with 11 additions and 1 deletions
  1. 6 1
      desktop/src/preload.ts
  2. 5 0
      desktop/src/utils/ipcComms.ts

+ 6 - 1
desktop/src/preload.ts

@@ -34,7 +34,6 @@ import * as fs from "promise-fs";
 import { Readable } from "stream";
 import { deleteDiskCache, openDiskCache } from "./api/cache";
 import { logToDisk, openLogDirectory } from "./api/common";
-import { clearElectronStore } from "./api/electronStore";
 import {
     checkExistsAndCreateDir,
     exists,
@@ -332,6 +331,12 @@ const openDirectory = async (dirPath: string): Promise<void> => {
 
 // -
 
+const clearElectronStore = () => {
+    ipcRenderer.send("clear-electron-store");
+};
+
+// -
+
 const updateAndRestart = () => {
     ipcRenderer.send("update-and-restart");
 };

+ 5 - 0
desktop/src/utils/ipcComms.ts

@@ -9,6 +9,7 @@ import {
     Tray,
 } from "electron";
 import path from "path";
+import { clearElectronStore } from "../api/electronStore";
 import {
     getAppVersion,
     muteUpdateNotification,
@@ -90,6 +91,10 @@ export default function setupIpcComs(
         return safeStorage.decryptString(message);
     });
 
+    ipcMain.on("clear-electron-store", () => {
+        clearElectronStore();
+    });
+
     ipcMain.handle("get-path", (_, message) => {
         // By default, these paths are at the following locations:
         //