Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Apr 23, 2024
1 parent 3fb34fb commit d9b4b33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ ipcMain.on(SHUTDOWN_FINISHED, () => {
ipcMain.on(CLEAR_WALLET_FILES, () => {
walletManager.setRelaunch(true)
walletManager.setForceQuit(true)
walletManager.clearWalletFiles(SHEIKAH_PATH)
win.webContents.send(SHUTDOWN)
walletManager.setClearWalletFiles(true)
walletManager.killWalletProcess()
})

app.on('activate', () => {
Expand Down
9 changes: 8 additions & 1 deletion electron/walletManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface GithubTagInfo {
export class WalletManager {
public webContents: Electron.WebContents | null
public isUpdating: boolean = false
public clearFiles: boolean = false
public relaunch: boolean = false
public forceQuit: boolean = false
public walletProcess: cp.ChildProcessWithoutNullStreams | null = null
Expand Down Expand Up @@ -158,6 +159,10 @@ export class WalletManager {
this.forceQuit = status
}

public setClearWalletFiles(status: boolean) {
this.clearFiles = status
}

// Download a wallet release from the url specified
public async downloadWallet(actions: Actions, releaseUrl: string) {
console.info(
Expand All @@ -179,7 +184,6 @@ export class WalletManager {
}

public clearWalletFiles(pathToClear: string) {
this.killWalletProcess()
console.log('Exists path?', fs.existsSync(pathToClear))
if (fs.existsSync(pathToClear)) {
fs.rmSync(pathToClear, { recursive: true, force: true })
Expand Down Expand Up @@ -312,6 +316,9 @@ export class WalletManager {
this.walletProcess.on('exit', () => {
console.log('FORCE QUIT?', this.forceQuit)
console.log('Relaunch?', this.relaunch)
if (this.clearFiles) {
this.clearWalletFiles(SHEIKAH_PATH)
}
if (this.forceQuit) {
if (this.relaunch) {
actions.relaunch()
Expand Down

0 comments on commit d9b4b33

Please sign in to comment.