Skip to content

Commit

Permalink
Update paths to electron local storage in electron.js
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan committed Dec 18, 2024
1 parent 82ec664 commit a6a22ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions apps/desktop/public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ protocol.registerSchemesAsPrivileged([
]);

// Configure electron-log
log.transports.file.file = path.join(app.getPath("userData"), "Local Storage", "umami-desktop.log");
log.transports.file.resolvePathFn = () => path.join(app.getPath("userData"), "umami-desktop.log");

async function createBackupFromPrevDB() {
const dbPath = path.join(app.getPath("userData"), "Local Storage", "leveldb");
const backupPath = path.join(app.getPath("userData"), "Local Storage", "backup_leveldb.json");
const dbPath = path.normalize(path.join(app.getPath("userData"), "Local Storage", "leveldb"));
const backupPath = path.normalize(
path.join(app.getPath("userData"), "Local Storage", "backup_leveldb.json")
);

if (fs.existsSync(backupPath)) {
console.log("Backup file already exists. Skipping migration.");
Expand Down Expand Up @@ -311,7 +313,7 @@ function start() {
}
mainWindow.focus();
// Protocol handler for win32
// argv: An array of the second instances (command line / deep linked) arguments
// argv: An array of the second instance's (command line / deep linked) arguments
if (process.platform === "win32" || process.platform === "linux") {
// Protocol handler for windows & linux
const index = argv.findIndex(arg => arg.startsWith("umami://"));
Expand All @@ -338,8 +340,12 @@ function start() {
// Some APIs can only be used after this event occurs.
app.whenReady().then(async () => {
// Execute createBackupFromPrevDB at the beginning
await createBackupFromPrevDB();
createWindow();
try {
await createBackupFromPrevDB();
createWindow();
} catch (error) {
log.error("Error has occured while initialising the app", error);
}
});

app.on("activate", function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/state/src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const getTestStorage = () => {
: TEST_STORAGE;
};

export const processMigrationData = (backupData: any) => {
const processMigrationData = (backupData: any) => {
try {
const processedData: { accounts: any; root: any } = {
accounts: {},
Expand Down

1 comment on commit a6a22ae

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title Lines Statements Branches Functions
apps/desktop Coverage: 83%
83.81% (1786/2131) 79.58% (850/1068) 78.27% (454/580)
apps/web Coverage: 83%
83.81% (1786/2131) 79.58% (850/1068) 78.27% (454/580)
packages/components Coverage: 97%
97.51% (196/201) 95.91% (94/98) 88.13% (52/59)
packages/core Coverage: 81%
82.47% (207/251) 72.72% (88/121) 81.35% (48/59)
packages/crypto Coverage: 100%
100% (43/43) 90.9% (10/11) 100% (7/7)
packages/data-polling Coverage: 97%
95.27% (141/148) 87.5% (21/24) 92.85% (39/42)
packages/multisig Coverage: 98%
98.47% (129/131) 85.71% (18/21) 100% (36/36)
packages/social-auth Coverage: 100%
100% (21/21) 100% (11/11) 100% (3/3)
packages/state Coverage: 82%
82.28% (822/999) 76.42% (188/246) 77.77% (301/387)
packages/tezos Coverage: 89%
88.72% (118/133) 94.59% (35/37) 86.84% (33/38)
packages/tzkt Coverage: 89%
87.32% (62/71) 87.5% (14/16) 80.48% (33/41)

Please sign in to comment.