退出优化
This commit is contained in:
parent
0a63a75574
commit
703596bd4a
3
main.js
3
main.js
|
|
@ -191,7 +191,8 @@ app.on('ready', () => {
|
|||
clipboard.writeText(text)
|
||||
});
|
||||
// 退出
|
||||
ipcMain.handle('quit', (event) => {
|
||||
ipcMain.handle('quit', async (event) => {
|
||||
await mainWindow.webContents.send('quitAndInstall');
|
||||
quit()
|
||||
});
|
||||
// 加入房间通知
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ window.electron = {
|
|||
onUpdate: (callback) => {
|
||||
ipcRenderer.on('update', callback)
|
||||
},
|
||||
// 执行退出房间
|
||||
quitAndInstall: (callback) => {
|
||||
ipcRenderer.on('quitAndInstall', callback)
|
||||
},
|
||||
// 通知下载最新的包
|
||||
onDownload: (type) => {
|
||||
ipcRenderer.invoke('updateDownload', type)
|
||||
|
|
|
|||
16
src/App.tsx
16
src/App.tsx
|
|
@ -129,6 +129,15 @@ const App: React.FC = () => {
|
|||
}
|
||||
storage.setItem('setting', JSON.stringify(setting))
|
||||
})
|
||||
window.electron.quitAndInstall(async (_e: any) => {
|
||||
if (location.hash.indexOf('/meeting') === 1) {
|
||||
const data = JSON.parse(localStorage.stateInfo);
|
||||
await onInvoke('levelChannel', {
|
||||
roomNum: data.channelId
|
||||
})
|
||||
await agora.leaveChannel()
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
onInvitation((item: any) => {
|
||||
|
|
@ -171,13 +180,6 @@ const App: React.FC = () => {
|
|||
setIsState(false)
|
||||
window.electron.onQuit(async () => {
|
||||
if (storage.getItem('isTips') === 'true') {
|
||||
if (location.hash.indexOf('/meeting') !== -1) {
|
||||
const data = JSON.parse(localStorage.stateInfo);
|
||||
await onInvoke('levelChannel', {
|
||||
roomNum: data.channelId
|
||||
})
|
||||
await agora.leaveChannel()
|
||||
}
|
||||
window.electron.quit()
|
||||
} else {
|
||||
quitTipsRef.current.changeModal()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export interface IElectronAPI {
|
|||
getSources: () => any;
|
||||
quit: () => any;
|
||||
downFile: (callBack: Function) => void;
|
||||
quitAndInstall: (callBack: Function) => void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
|
|
|||
Loading…
Reference in New Issue