Skip to content

Commit a7f8525

Browse files
authored
Revert "refactor(service-providers): add agoraAppId config in join room (#2…" (#2153)
This reverts commit 4ff8041.
1 parent 4ff8041 commit a7f8525

File tree

10 files changed

+6
-40
lines changed

10 files changed

+6
-40
lines changed

packages/flat-server-api/src/room.ts

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export interface JoinRoomResult {
103103
rtmToken: string;
104104
showGuide: boolean;
105105
region: Region;
106-
agoraAppId?: string;
107106
billing?: {
108107
/** minutes */
109108
limit: number;

packages/flat-services/src/services/text-chat/text-chat.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export interface IServiceTextChatJoinRoomConfig {
1414
ownerUUID: string;
1515
uid: string;
1616
token?: string | null;
17-
agoraAppId?: string | null;
1817
}
1918

2019
export abstract class IServiceTextChat implements IService {

packages/flat-services/src/services/video-chat/video-chat.ts

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface IServiceVideoChatJoinRoomConfig {
3030
shareScreenUID: IServiceVideoChatUID;
3131
shareScreenToken: string;
3232
mirror?: boolean;
33-
agoraAppId?: string | null;
3433
}
3534

3635
export abstract class IServiceVideoChat implements IService {

packages/flat-stores/src/classroom-store/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ export class ClassroomStore {
376376
ownerUUID: this.ownerUUID,
377377
uid: this.userUUID,
378378
token: globalStore.rtmToken,
379-
agoraAppId: globalStore.agoraAppId,
380379
});
381380

382381
const fastboard = await this.whiteboardStore.joinWhiteboardRoom();
@@ -1509,7 +1508,6 @@ export class ClassroomStore {
15091508
shareScreenUID: String(globalStore.rtcShareScreen?.uid || -1),
15101509
shareScreenToken: globalStore.rtcShareScreen?.token || "",
15111510
mirror: preferencesStore.mirrorMode,
1512-
agoraAppId: globalStore.agoraAppId,
15131511
});
15141512

15151513
if (preferencesStore.cameraId) {

packages/flat-stores/src/global-store.ts

-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export class GlobalStore {
6767
* Room's region, services (currently only whiteboard) must use this value to join the room.
6868
*/
6969
public region: Region | null = null;
70-
public agoraAppId: string | null = null;
7170
public rtcToken: string | null = null;
7271
public rtcUID: number | null = null;
7372
public rtcShareScreen: {
@@ -220,7 +219,6 @@ export class GlobalStore {
220219
| "rtcUID"
221220
| "rtcShareScreen"
222221
| "region"
223-
| "agoraAppId"
224222
>
225223
>,
226224
): void => {
@@ -232,7 +230,6 @@ export class GlobalStore {
232230
"rtcUID",
233231
"rtcShareScreen",
234232
"region",
235-
"agoraAppId",
236233
] as const;
237234
for (const key of keys) {
238235
const value = config[key];

packages/flat-stores/src/room-store.ts

-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export interface RoomItem {
5757
expireAt: number;
5858
vipLevel: 0 | 1;
5959
};
60-
agoraAppId?: string;
6160
}
6261

6362
// Only keep sub-room ids. sub-room info are stored in ordinaryRooms.
@@ -145,7 +144,6 @@ export class RoomStore {
145144
ownerUUID: data.ownerUUID,
146145
roomType: data.roomType,
147146
billing: data.billing,
148-
agoraAppId: data.agoraAppId,
149147
});
150148
return data;
151149
}

service-providers/agora-rtc/agora-rtc-electron/src/agora-rtc-electron.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ export class AgoraRTCElectron extends IServiceVideoChat {
3232
public readonly isMac: boolean;
3333
public readonly shareScreen = new AgoraRTCElectronShareScreen({ rtc: this });
3434

35+
public readonly APP_ID: string;
3536
public readonly rtcEngine: AgoraSdk;
3637

3738
private readonly _roomSideEffect = new SideEffectManager();
3839

39-
public APP_ID: string;
40-
4140
private _cameraID?: string;
4241
private _micID?: string;
4342
private _speakerID?: string;
@@ -204,12 +203,6 @@ export class AgoraRTCElectron extends IServiceVideoChat {
204203
}
205204
this.leaveRoom();
206205
}
207-
208-
if (config.agoraAppId && config.agoraAppId !== this.APP_ID) {
209-
this.rtcEngine.release(true);
210-
this.rtcEngine.initialize((this.APP_ID = config.agoraAppId));
211-
}
212-
213206
return this._join(config);
214207
}
215208

service-providers/agora-rtc/agora-rtc-web/src/agora-rtc-web.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export interface AgoraRTCWebConfig {
4242
}
4343

4444
export class AgoraRTCWeb extends IServiceVideoChat {
45+
public readonly APP_ID: string;
46+
4547
public readonly shareScreen: AgoraRTCWebShareScreen;
4648

4749
private readonly _roomSideEffect = new SideEffectManager();
@@ -50,7 +52,6 @@ export class AgoraRTCWeb extends IServiceVideoChat {
5052
private _pLeavingRoom?: Promise<unknown>;
5153
private _testingAudio?: HTMLAudioElement;
5254

53-
public APP_ID: string;
5455
public client?: IAgoraRTCClient;
5556
public mode?: IServiceVideoChatMode;
5657

@@ -357,7 +358,6 @@ export class AgoraRTCWeb extends IServiceVideoChat {
357358
shareScreenUID,
358359
shareScreenToken,
359360
mirror,
360-
agoraAppId,
361361
}: IServiceVideoChatJoinRoomConfig): Promise<void> {
362362
this._roomSideEffect.flushAll();
363363

@@ -494,10 +494,6 @@ export class AgoraRTCWeb extends IServiceVideoChat {
494494
}),
495495
);
496496

497-
if (agoraAppId && agoraAppId !== this.APP_ID) {
498-
this.APP_ID = agoraAppId;
499-
}
500-
501497
await client.join(
502498
this.APP_ID,
503499
roomUUID,

service-providers/agora-rtm/src/rtm.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ export class AgoraRTM extends IServiceTextChat {
2424
private _pJoiningRoom?: Promise<unknown>;
2525
private _pLeavingRoom?: Promise<unknown>;
2626

27-
public client: RtmClient;
27+
public readonly client: RtmClient;
2828
public channel?: RtmChannel;
2929

3030
private roomUUID?: string;
3131
private userUUID?: string;
3232
private token?: string;
3333

34-
public constructor(public APP_ID: string) {
34+
public constructor(APP_ID: string) {
3535
super();
3636
if (!APP_ID) {
3737
throw new Error("APP_ID is not set");
@@ -185,21 +185,13 @@ export class AgoraRTM extends IServiceTextChat {
185185
token,
186186
roomUUID,
187187
ownerUUID,
188-
agoraAppId,
189188
}: IServiceTextChatJoinRoomConfig): Promise<void> {
190189
this.token = token || (await generateRTMToken());
191190

192191
if (!this.token) {
193192
throw new Error("Missing Agora RTM token");
194193
}
195194

196-
if (agoraAppId && agoraAppId !== this.APP_ID) {
197-
this.APP_ID = agoraAppId;
198-
this.client = RtmEngine.createInstance(this.APP_ID, {
199-
logFilter: RtmEngine.LOG_FILTER_WARNING,
200-
});
201-
}
202-
203195
this._roomSideEffect.add(() => {
204196
const handler = async (): Promise<void> => {
205197
this.token = await generateRTMToken();

service-providers/agora-rtm2/src/rtm2.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class AgoraRTM2 extends IServiceTextChat {
2828
private userUUID?: string;
2929
private token?: string;
3030

31-
public constructor(public APP_ID: string) {
31+
public constructor(private readonly APP_ID: string) {
3232
super();
3333
if (!APP_ID) {
3434
throw new Error("APP_ID is not set");
@@ -162,18 +162,13 @@ export class AgoraRTM2 extends IServiceTextChat {
162162
token,
163163
roomUUID,
164164
ownerUUID,
165-
agoraAppId,
166165
}: IServiceTextChatJoinRoomConfig): Promise<void> {
167166
this.token = token || (await generateRTMToken());
168167

169168
if (!this.token) {
170169
throw new Error("Missing Agora RTM token");
171170
}
172171

173-
if (agoraAppId && agoraAppId !== this.APP_ID) {
174-
this.APP_ID = agoraAppId;
175-
}
176-
177172
const client = (this.client = new RTM(this.APP_ID, uid, {
178173
logLevel: "warn",
179174
logUpload: !process.env.DEV,

0 commit comments

Comments
 (0)