Skip to content

Commit

Permalink
refactor: fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed May 5, 2022
1 parent e806e42 commit 1c9562e
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion desktop/renderer-app/src/api-middleware/rtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Rtc {
throw new Error("Agora App Id not set.");
}

this.rtcEngine = window.rtcEngine;
this.rtcEngine = (window as any).agoraRtcSDK$.value;

this.rtcEngine.on("tokenPrivilegeWillExpire", this.renewToken);
this.rtcEngine.on("groupAudioVolumeIndication", this.updateVolumeLevel);
Expand Down
3 changes: 1 addition & 2 deletions desktop/renderer-app/src/services/flat-rtc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FlatRTC } from "@netless/flat-rtc";
import { FlatRTCAgoraElectron } from "@netless/flat-rtc-agora-electron";
import { AGORA } from "../constants/process";

export function initFlatRTC(): Promise<void> {
const agoraRtcSDK$ = (window as any).agoraRtcSDK$;
Expand All @@ -11,7 +10,7 @@ export function initFlatRTC(): Promise<void> {
return new Promise(resolve => {
agoraRtcSDK$.subscribe((rtcEngine: any) => {
if (rtcEngine) {
FlatRTCAgoraElectron.APP_ID = AGORA.APP_ID;
FlatRTCAgoraElectron.APP_ID = process.env.AGORA_APP_ID;
FlatRTCAgoraElectron.setRtcEngine(rtcEngine);
resolve();
}
Expand Down
4 changes: 0 additions & 4 deletions desktop/renderer-app/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,3 @@ declare namespace NodeJS {
interface PortalWindow extends Window {
browserWindowID: string;
}

interface Window {
rtcEngine: any;
}
2 changes: 1 addition & 1 deletion web/flat-web/src/pages/BigClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export const BigClassPage = observer<BigClassPageProps>(function BigClassPage()
<TopBarRightBtn
icon={<SVGScreenSharing active={classRoomStore.isScreenSharing} />}
title={t("share-screen.self")}
onClick={classRoomStore.toggleShareScreen}
onClick={() => classRoomStore.toggleShareScreen()}
/>
)}

Expand Down
2 changes: 1 addition & 1 deletion web/flat-web/src/pages/OneToOnePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const OneToOnePage = observer<OneToOnePageProps>(function OneToOnePage()
<TopBarRightBtn
icon={<SVGScreenSharing active={classRoomStore.isScreenSharing} />}
title={t("share-screen.self")}
onClick={classRoomStore.toggleShareScreen}
onClick={() => classRoomStore.toggleShareScreen()}
/>
)}

Expand Down
2 changes: 1 addition & 1 deletion web/flat-web/src/pages/SmallClassPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const SmallClassPage = observer<SmallClassPageProps>(function SmallClassP
<TopBarRightBtn
icon={<SVGScreenSharing active={classRoomStore.isScreenSharing} />}
title={t("share-screen.self")}
onClick={classRoomStore.toggleShareScreen}
onClick={() => classRoomStore.toggleShareScreen()}
/>
)}

Expand Down
3 changes: 1 addition & 2 deletions web/flat-web/src/services/flat-rtc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { FlatRTC } from "@netless/flat-rtc";
import { FlatRTCAgoraWeb } from "@netless/flat-rtc-agora-web";
import { AGORA } from "../constants/process";

export function initFlatRTC(): void {
FlatRTCAgoraWeb.APP_ID = AGORA.APP_ID;
FlatRTCAgoraWeb.APP_ID = process.env.AGORA_APP_ID;
}

export const getFlatRTC: () => FlatRTC = FlatRTCAgoraWeb.getInstance;

0 comments on commit 1c9562e

Please sign in to comment.