Skip to content

Commit

Permalink
fix: connectToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
ircfspace committed Jun 17, 2024
1 parent 6550d62 commit 907dd01
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ if (!gotTheLock) {
});*/
ipcMain.on('tray-menu', (event) => {
event.reply('tray-menu', {
key: 'connectToggle',
key: 'connect',
msg: 'Connect Tray Click!'
});
});
Expand Down Expand Up @@ -304,7 +304,7 @@ if (!gotTheLock) {
connectStatus === 'disconnected'
) {
trayMenuEvent?.reply('tray-menu', {
key: 'connectToggle',
key: connectStatus === 'disconnected' ? 'connect' : 'disconnect',
msg: 'Connect Tray Click!'
});
}
Expand Down
15 changes: 13 additions & 2 deletions src/renderer/pages/Landing/useLanding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,19 @@ const useLanding = () => {
});

ipcRenderer.on('tray-menu', (args: any) => {
if (args.key === 'connectToggle' && !isLoading) {
onChange();
if (args.key === 'connect' && !isLoading) {
setIpInfo({
countryCode: false,
ip: ''
});
setProxyStatus(proxyMode);
ipcRenderer.sendMessage('wp-start');
setIsLoading(true);
setPing(0);
}
if (args.key === 'disconnect' && !isLoading) {
ipcRenderer.sendMessage('wp-end');
setIsLoading(true);
}
if (args.key === 'changePage') {
navigate(args.msg);
Expand Down

0 comments on commit 907dd01

Please sign in to comment.