-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create main events service and fix setup style
- Loading branch information
Showing
7 changed files
with
55 additions
and
68 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,45 @@ | ||
import { | ||
onDownloadedStatus, | ||
onRunningStatus, | ||
onLoadedStatus, | ||
onDownloadProgress, | ||
onOSNotSupported, | ||
onMessage, | ||
onShutdown, | ||
} from '@/ipc/ipcEvents' | ||
import { sendShutdownFinished } from '@/ipc/ipcMessages' | ||
import { Router } from 'vue-router' | ||
|
||
export function listenIpcMainEvents({ | ||
store, | ||
router, | ||
}: { | ||
store: any | ||
router: Router | ||
}) { | ||
onShutdown(async () => { | ||
await store.dispatch('shutdown') | ||
sendShutdownFinished() | ||
}) | ||
onMessage((message: string) => { | ||
console.log('Message from Main process:', message) | ||
}) | ||
onDownloadProgress((progress: any) => { | ||
store.commit('setProgress', { progress: progress.percentage }) | ||
}) | ||
onDownloadedStatus(() => { | ||
store.commit('setMessage', { message: 'wallet up to date' }) | ||
}) | ||
onLoadedStatus((message: any) => { | ||
if (Array.isArray(message) && message[0].isDefaultWallet) { | ||
store.commit('setWalletOwner', { isDefaultWallet: true }) | ||
} | ||
store.commit('setMessage', { message: 'loaded' }) | ||
}) | ||
onRunningStatus(() => { | ||
store.commit('setMessage', { message: 'Running wallet' }) | ||
}) | ||
onOSNotSupported(() => { | ||
router.push('/wallet-not-found') | ||
}) | ||
} |
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