Skip to content

Commit

Permalink
refactor: desktop 错误捕获与离开房间
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jun 4, 2022
1 parent 26ee4de commit 16db20f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/src/RoomClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import type { ConsumerType } from './store/reducers/consumers';
import type { IceParameters } from 'mediasoup-client/lib/types';
import { getEncodings } from 'tailchat-meeting-sdk/lib/helper/encodings';
import { meActions } from './store/slices/me';
import isElectron from 'is-electron';

type Priority = 'high' | 'medium' | 'low' | 'very-low';

Expand Down Expand Up @@ -492,8 +493,12 @@ export class RoomClient {

store.dispatch(roomActions.setRoomState('closed'));

// @ts-ignore
window.location.href = `/room/${this._roomId}`;
// TODO: 临时操作,not good. 后期换成SDK后改掉
if (isElectron()) {
window.location.reload();
} else {
window.location.href = `/room/${this._roomId}`;
}
}

_startKeyListener() {
Expand Down
11 changes: 9 additions & 2 deletions desktop/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ if (isDebug) {
require('electron-debug')();
}

if (app.isPackaged) {
log.info('auto catch errors and overwrite default `console.log` functions');
log.catchErrors();
Object.assign(console, log.functions);
}

const installExtensions = async () => {
const installer = require('electron-devtools-installer');
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
Expand Down Expand Up @@ -95,8 +101,9 @@ const createWindow = async () => {
},
});

log.info('loadUrl:', resolveHtmlPath('index.html'));
mainWindow.loadURL(resolveHtmlPath('index.html'));
const url = resolveHtmlPath('index.html');
log.info('loadUrl:', url);
mainWindow.loadURL(url);

mainWindow.on('ready-to-show', () => {
if (!mainWindow) {
Expand Down

0 comments on commit 16db20f

Please sign in to comment.