diff --git a/apps/desktop-e2e/cucumber.cjs b/apps/desktop-e2e/cucumber.cjs index 56464cc7a..f51746fbe 100644 --- a/apps/desktop-e2e/cucumber.cjs +++ b/apps/desktop-e2e/cucumber.cjs @@ -14,7 +14,7 @@ const config = { failFast: true, paths: ["src/features/*"], require: ["src/**/*.ts"], - requireModule: ["ts-node/register/transpile-only", "tsconfig-paths/register"], + requireModule: ["ts-node/register"], format: ["html:test-results/cucumber-report.html", "json:test-results/cucumber-report.json"], }, }; diff --git a/apps/desktop-e2e/package.json b/apps/desktop-e2e/package.json index f4ccdfbc5..d9a81dab2 100644 --- a/apps/desktop-e2e/package.json +++ b/apps/desktop-e2e/package.json @@ -22,8 +22,7 @@ "eslint": "^8.57.0", "madge": "^8.0.0", "prettier": "^3.4.2", - "rimraf": "^6.0.1", - "tsconfig-paths": "^4.2.0" + "rimraf": "^6.0.1" }, "dependencies": { "@cucumber/cucumber": "^11.1.1", diff --git a/apps/desktop-e2e/src/global.d.ts b/apps/desktop-e2e/src/global.d.ts deleted file mode 100644 index 60c66fe14..000000000 --- a/apps/desktop-e2e/src/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {}; - -declare global { - interface Window { - electronAPI?: { - onBackupData: (fn: (event: any, data?: Record) => void) => void; - }; - } -} diff --git a/apps/desktop-e2e/tsconfig.json b/apps/desktop-e2e/tsconfig.json index 178a42256..627f12aeb 100644 --- a/apps/desktop-e2e/tsconfig.json +++ b/apps/desktop-e2e/tsconfig.json @@ -1,5 +1,4 @@ { - "extends": "@umami/typescript-config/tsconfig.json", "compilerOptions": { "target": "esnext", "allowJs": true, @@ -15,13 +14,10 @@ "noEmit": true, "jsx": "react-jsx", "customConditions": ["@umami/source"], - "preserveSymlinks": true, - "types": ["node", "jest"] + "preserveSymlinks": true }, "ts-node": { - "esm": true, - "transpileOnly": true, - "files": true + "esm": true }, - "include": ["src", ".eslintrc.cjs", "cucumber.cjs", "src/global.d.ts"] + "include": ["src", ".eslintrc.cjs", "cucumber.cjs"] } diff --git a/apps/desktop/public/electron.js b/apps/desktop/public/electron.js index 23b0da3cc..69ea008fc 100644 --- a/apps/desktop/public/electron.js +++ b/apps/desktop/public/electron.js @@ -11,9 +11,6 @@ const fs = require("fs"); const APP_PROTOCOL = "app"; const APP_HOST = "assets"; -// backupData is used to store the backup data from the previous version of the app -let backupData; - const appURL = app.isPackaged ? url.format({ pathname: `${APP_HOST}/index.html`, @@ -64,20 +61,19 @@ async function createBackupFromPrevDB() { return; } - // Copy the database to not lose original data - fs.cpSync(dbPath, dbBackupPath, { recursive: true }); - - if (fs.existsSync(backupPath)) { log.info("Backup file already exists. Skipping migration."); return; } + // Copy the database to not lose original data + fs.cpSync(dbPath, dbBackupPath, { recursive: true }); + const db = new Level(dbBackupPath); // Retry logic for opening the database const maxRetries = 3; - const retryDelay = 1000; // 1 second + const retryDelay = 1000; const tryOpenDb = async retriesLeft => { try { @@ -88,7 +84,6 @@ async function createBackupFromPrevDB() { } catch (error) { if (retriesLeft <= 0) { log.error("Failed to open DB after all retries", error); - await db.close(); throw error; } @@ -100,7 +95,6 @@ async function createBackupFromPrevDB() { try { await tryOpenDb(maxRetries); - log.info("DB is opened"); const storage = {}; @@ -169,9 +163,7 @@ async function createBackupFromPrevDB() { "persist:root": extractKeys(storage["persist:root"]), }; - backupData = preparedStorage; - - // Write storage object to JSON file + // Write preparedStorage to JSON file try { fs.writeFileSync(backupPath, JSON.stringify(preparedStorage, null, 2), "utf-8"); log.info("Backup successfully created at:", backupPath); @@ -294,8 +286,6 @@ function createWindow() { mainWindow.once("ready-to-show", () => { mainWindow.show(); - mainWindow.webContents.send("backupData", backupData); - if (deeplinkURL) { mainWindow.webContents.send("deeplinkURL", deeplinkURL); deeplinkURL = null; diff --git a/apps/desktop/public/preload.js b/apps/desktop/public/preload.js index 5628baece..ed4d210d2 100644 --- a/apps/desktop/public/preload.js +++ b/apps/desktop/public/preload.js @@ -15,13 +15,11 @@ contextBridge.exposeInMainWorld("electronAPI", { // Notify UI if app update is available to be installed. onAppUpdateDownloaded: callback => ipcRenderer.on("app-update-downloaded", callback), - // handle the backupData send in electron.js - onBackupData: callback => ipcRenderer.on("backupData", callback), - getBackupData: () => ipcRenderer.invoke("getBackupData"), - // Notify Electron that app update should be installed. installAppUpdateAndQuit: () => ipcRenderer.send("install-app-update"), clipboardWriteText: text => ipcRenderer.send("clipboard-write", text), clipboardClear: () => ipcRenderer.send("clipboard-clear"), + + getBackupData: () => ipcRenderer.invoke("getBackupData"), }); diff --git a/apps/desktop/src/Router.tsx b/apps/desktop/src/Router.tsx index 2c19fa1c7..70cfa50ae 100644 --- a/apps/desktop/src/Router.tsx +++ b/apps/desktop/src/Router.tsx @@ -9,11 +9,10 @@ import { useResetBeaconConnections, } from "@umami/state"; import { noop } from "lodash"; -import { useEffect, useState } from "react"; +import { useEffect } from "react"; import { HashRouter, Navigate, Route, Routes } from "react-router-dom"; import { AnnouncementBanner } from "./components/AnnouncementBanner"; -import { Loader } from "./components/Loader/Loader"; import { SocialLoginWarningModal } from "./components/SocialLoginWarningModal/SocialLoginWarningModal"; import { BeaconProvider } from "./utils/beacon/BeaconProvider"; import { persistor } from "./utils/persistor"; @@ -87,27 +86,21 @@ const LoggedOutRouter = () => { WalletClient.destroy().then(resetBeaconConnections).catch(noop); }, [resetBeaconConnections]); - const [isDataLoading, setIsDataLoading] = useState( - () => !localStorage.getItem("migration_2_3_3_to_2_3_4_completed") - ); - useEffect(() => { if (localStorage.getItem("migration_2_3_3_to_2_3_4_completed")) { return; } const getBackupData = async () => { - persistor.pause(); - const backupData = await window.electronAPI.getBackupData(); if (!backupData) { - setIsDataLoading(false); localStorage.setItem("migration_2_3_3_to_2_3_4_completed", "true"); - persistor.persist(); return; } + persistor.pause(); + await persistor.flush(); localStorage.clear(); @@ -124,14 +117,11 @@ const LoggedOutRouter = () => { }, []); return ( - <> - {isDataLoading && } - - - } path="/*" /> - } path="/welcome" /> - - - + + + } path="/*" /> + } path="/welcome" /> + + ); }; diff --git a/apps/desktop/src/global.d.ts b/apps/desktop/src/global.d.ts index b62a71447..f3d25f824 100644 --- a/apps/desktop/src/global.d.ts +++ b/apps/desktop/src/global.d.ts @@ -8,7 +8,6 @@ declare global { onDeeplink: (callback: (url: string) => void) => void; onAppUpdateDownloaded: (callback: () => void) => void; installAppUpdateAndQuit: () => void; - onBackupData: (fn: (event: any, data?: Record) => void) => void; getBackupData: () => Promise | undefined>; }; } diff --git a/apps/web/src/global.d.ts b/apps/web/src/global.d.ts deleted file mode 100644 index 60c66fe14..000000000 --- a/apps/web/src/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {}; - -declare global { - interface Window { - electronAPI?: { - onBackupData: (fn: (event: any, data?: Record) => void) => void; - }; - } -} diff --git a/packages/components/src/global.d.ts b/packages/components/src/global.d.ts deleted file mode 100644 index 60c66fe14..000000000 --- a/packages/components/src/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {}; - -declare global { - interface Window { - electronAPI?: { - onBackupData: (fn: (event: any, data?: Record) => void) => void; - }; - } -} diff --git a/packages/data-polling/src/global.d.ts b/packages/data-polling/src/global.d.ts deleted file mode 100644 index 60c66fe14..000000000 --- a/packages/data-polling/src/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {}; - -declare global { - interface Window { - electronAPI?: { - onBackupData: (fn: (event: any, data?: Record) => void) => void; - }; - } -} diff --git a/packages/state/src/global.d.ts b/packages/state/src/global.d.ts deleted file mode 100644 index 60c66fe14..000000000 --- a/packages/state/src/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {}; - -declare global { - interface Window { - electronAPI?: { - onBackupData: (fn: (event: any, data?: Record) => void) => void; - }; - } -} diff --git a/packages/state/src/slices/accounts/accounts.test.ts b/packages/state/src/slices/accounts/accounts.test.ts index b73e9a57e..677ad252b 100644 --- a/packages/state/src/slices/accounts/accounts.test.ts +++ b/packages/state/src/slices/accounts/accounts.test.ts @@ -24,6 +24,10 @@ describe("accountsSlice", () => { seedPhrases: {}, secretKeys: {}, password: "", + alerts: { + isSocialLoginWarningShown: false, + isExtensionsWarningShown: false, + }, }); }); @@ -57,6 +61,10 @@ describe("accountsSlice", () => { seedPhrases: { mockPrint1: {}, mockPrint2: {} }, secretKeys: {}, password: "", + alerts: { + isSocialLoginWarningShown: false, + isExtensionsWarningShown: false, + }, }); store.dispatch(accountsActions.removeMnemonicAndAccounts({ fingerPrint: "mockPrint1" })); @@ -66,6 +74,10 @@ describe("accountsSlice", () => { seedPhrases: { mockPrint2: {} }, secretKeys: {}, password: "", + alerts: { + isSocialLoginWarningShown: false, + isExtensionsWarningShown: false, + }, }); }); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e07d2f34d..090008bb1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -473,9 +473,6 @@ importers: rimraf: specifier: ^6.0.1 version: 6.0.1 - tsconfig-paths: - specifier: ^4.2.0 - version: 4.2.0 apps/embed-iframe: dependencies: @@ -16379,9 +16376,7 @@ snapshots: transitivePeerDependencies: - '@babel/core' - '@babel/preset-env' - - bufferutil - supports-color - - utf-8-validate '@react-native/normalize-color@2.1.0': {}