This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from DeFiCh/develop
release defi-app v1.0.3
- Loading branch information
Showing
100 changed files
with
2,956 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as log from '../services/electronLogger'; | ||
import DialogManager from '../services/dialogmanager'; | ||
import { getFileData, writeFile } from '../utils'; | ||
|
||
export default class Logs { | ||
async download(data: string, extension: string) { | ||
try { | ||
const dialogManager = new DialogManager(); | ||
const paths = await dialogManager.saveFilePath(); | ||
if (!paths.length) { | ||
throw new Error('No valid path available'); | ||
} | ||
paths.slice(-5).includes(extension) | ||
? writeFile(paths, data) | ||
: writeFile(paths + extension, data); | ||
} catch (err) { | ||
log.error(err); | ||
} | ||
} | ||
|
||
async read(filePath: string) { | ||
try { | ||
const data = getFileData(filePath); | ||
return data; | ||
} catch (err) { | ||
log.error(err); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { CancellationToken } from 'electron-updater'; | ||
import { app, ipcMain } from 'electron'; | ||
import { POST_UPDATE_ACTION, START_DOWNLOAD_UPDATE } from '../constants'; | ||
|
||
export default function initiateAppUpdateManager(autoUpdater: any) { | ||
ipcMain.on(POST_UPDATE_ACTION, () => { | ||
autoUpdater.quitAndInstall(); | ||
app.exit(); | ||
}); | ||
|
||
ipcMain.on(START_DOWNLOAD_UPDATE, () => { | ||
const cancellationToken = new CancellationToken(); | ||
autoUpdater.downloadUpdate(cancellationToken); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ipcMain } from 'electron'; | ||
import { WALLET_BACKUP, BACKUP_WALLET_DAT } from '../constants'; | ||
import Wallet from '../controllers/wallets'; | ||
import { responseMessage } from '../utils'; | ||
|
||
const initiateBackupImportWalletManager = (bw: Electron.BrowserWindow) => { | ||
ipcMain.on(WALLET_BACKUP, async (event: Electron.IpcMainEvent) => { | ||
const wallet = new Wallet(); | ||
event.returnValue = await wallet.backup(bw); | ||
}); | ||
|
||
ipcMain.on(BACKUP_WALLET_DAT, async (event: Electron.IpcMainEvent) => { | ||
try { | ||
const wallet = new Wallet(); | ||
await wallet.backupWalletDat(); | ||
event.returnValue = responseMessage(true, {}); | ||
} catch (err) { | ||
event.returnValue = responseMessage(false, { | ||
message: err.message, | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
export default initiateBackupImportWalletManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
import { ipcMain } from 'electron'; | ||
import DefiProcessManager from '../services/defiprocessmanager'; | ||
import { START_DEFI_CHAIN, STOP_DEFI_CHAIN, RESTART_APP } from '../constants'; | ||
import { | ||
START_DEFI_CHAIN, | ||
STOP_DEFI_CHAIN, | ||
RESTART_APP, | ||
CLOSE_APP, | ||
FORCE_KILL_QUEUE_AND_SHUTDOWN, | ||
} from '../constants'; | ||
|
||
export default function initiateDefiProcessManager() { | ||
ipcMain.on(START_DEFI_CHAIN, async (event, arg) => { | ||
const defiProcessManager = new DefiProcessManager(); | ||
await defiProcessManager.start(arg, event); | ||
await DefiProcessManager.start(arg, event); | ||
}); | ||
|
||
ipcMain.on(STOP_DEFI_CHAIN, async (event) => { | ||
const defiProcessManager = new DefiProcessManager(); | ||
event.returnValue = await defiProcessManager.stop(); | ||
event.returnValue = await DefiProcessManager.stop(); | ||
}); | ||
|
||
ipcMain.on(RESTART_APP, async (event, args) => { | ||
const defiProcessManager = new DefiProcessManager(); | ||
event.returnValue = await defiProcessManager.restart(args, event); | ||
event.returnValue = await DefiProcessManager.restart(args, event); | ||
}); | ||
|
||
ipcMain.on(CLOSE_APP, async () => { | ||
await DefiProcessManager.closeApp(); | ||
}); | ||
|
||
ipcMain.on(FORCE_KILL_QUEUE_AND_SHUTDOWN, async () => { | ||
await DefiProcessManager.forceClose(); | ||
}); | ||
} |
Oops, something went wrong.