From 9bc6100576c9376d71b07f6537d5e4a31eec1c55 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Thu, 14 Jan 2021 12:28:57 +0100 Subject: [PATCH] fix: close wallet on terms reject, increase ledger poll --- app/hooks/use-ledger.ts | 2 +- app/main.dev.ts | 2 ++ app/pages/onboarding/00-terms/terms.tsx | 2 +- app/preload.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/hooks/use-ledger.ts b/app/hooks/use-ledger.ts index 62dc61296..501232027 100644 --- a/app/hooks/use-ledger.ts +++ b/app/hooks/use-ledger.ts @@ -12,7 +12,7 @@ export enum LedgerConnectStep { } const SAFE_ASSUME_REAL_DEVICE_DISCONNECT_TIME = 1000; -const POLL_LEDGER_INTERVAL = 250; +const POLL_LEDGER_INTERVAL = 750; export function useLedger() { const [step, setStep] = useState(LedgerConnectStep.Disconnected); diff --git a/app/main.dev.ts b/app/main.dev.ts index 6baddbb4f..2c8d3a0eb 100644 --- a/app/main.dev.ts +++ b/app/main.dev.ts @@ -195,6 +195,8 @@ ipcMain.handle('reload-app', () => { mainWindow?.reload(); }); +ipcMain.on('closeWallet', () => app.exit(0)); + // // TODO: refactor to be more generic // There's a bug where click handler doesn't fire for the top-level menu diff --git a/app/pages/onboarding/00-terms/terms.tsx b/app/pages/onboarding/00-terms/terms.tsx index 10e0fff36..aa3a3a514 100644 --- a/app/pages/onboarding/00-terms/terms.tsx +++ b/app/pages/onboarding/00-terms/terms.tsx @@ -213,7 +213,7 @@ export const Terms: React.FC = () => { - console.log('Close wallet')} mode="secondary"> + api.closeWallet()} mode="secondary"> Close history.push(routes.WELCOME)} ml="base"> diff --git a/app/preload.ts b/app/preload.ts index 25632e109..8f7e54479 100644 --- a/app/preload.ts +++ b/app/preload.ts @@ -93,6 +93,8 @@ const walletApi = { contextMenu: (menuItems: any) => ipcRenderer.send('context-menu-open', { menuItems }), installPath: () => ipcRenderer.sendSync('installPath'), + + closeWallet: () => ipcRenderer.send('closeWallet'), }; declare global {