Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widget列表控制处理 #43

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/gallery/classroom/hx-chat/fcr-chatroom/store/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,14 @@ export class RoomStore {
* @param ignoreScreenShare 忽略屏幕分享
* @param ignoreIm 忽略聊天
* @param ignorePoll 忽略投票
* @param ignoreCountDown 忽略倒计时
*/
private getWidgetList(ignoreScreenShare: boolean, ignoreIm: boolean, ignorePoll: boolean, list: AgoraWidgetBase[]): AgoraWidgetBase[] {
private getWidgetList(ignoreConfig:{ignoreScreenShare: boolean, ignoreIm: boolean, ignorePoll: boolean,ignoreCountDown?:boolean}, list: AgoraWidgetBase[]): AgoraWidgetBase[] {
const {ignoreScreenShare, ignoreIm, ignorePoll,ignoreCountDown} = ignoreConfig
return (list ? list : []).filter((v: { widgetName: string }) =>
!(v.widgetName === 'easemobIM' && ignoreIm
|| v.widgetName === 'poll' && ignorePoll
|| v.widgetName === 'countdownTimer' && (ignoreCountDown || false)
|| v.widgetName === 'poscreenSharell' && ignoreScreenShare)
)
}
Expand All @@ -170,7 +173,7 @@ export class RoomStore {

//重置显示的Widget视图
private resetShowDefaultWidget(isAddWieget:boolean){
const allWidgets = this.getWidgetList(false,true,true,this.z0Widgets || []);
const allWidgets = this.getWidgetList({ignoreScreenShare:false,ignoreIm:true,ignorePoll:true,ignoreCountDown:true},this.z0Widgets || []);
if (allWidgets.length > 0) {
this.setCurrentWidget(isAddWieget ? allWidgets[0] : allWidgets.find(item=>item.instanceId === this.currentWidget?.instanceId) || allWidgets[0])
} else {
Expand All @@ -185,8 +188,8 @@ export class RoomStore {
this._widget.classroomStore.widgetStore.widgetController,
);
//判断除了特殊的屏幕分享等Widget是否有更新
const lastList = this.getWidgetList(true, true, true, this._widgetInstanceList)
const newList = this.getWidgetList(true, true, true, Object.values(widgetInstances))
const lastList = this.getWidgetList({ignoreScreenShare:true,ignoreIm:true,ignorePoll:true}, this._widgetInstanceList)
const newList = this.getWidgetList({ignoreScreenShare:true,ignoreIm:true,ignorePoll:true}, Object.values(widgetInstances))
const noSpecialWidgetChange = !this.compareWidgetList(lastList,newList)
//是否是新增的
const isAddWieget = lastList.length < newList.length || !!this.screenShareStream && (!!lastList.find(item=>item.widgetName === "netlessBoard")) && !newList.find(item=>item.widgetName === "netlessBoard")
Expand Down