add trigger action after closing co-website or jitsi

This commit is contained in:
Lurkars 2021-04-17 14:29:50 +02:00 committed by Thomas Basler
parent fa813884c0
commit 5946e75db0
3 changed files with 52 additions and 0 deletions

View File

@ -62,6 +62,9 @@ class IframeListener {
private readonly _loadSoundStream: Subject<LoadSoundEvent> = new Subject();
public readonly loadSoundStream = this._loadSoundStream.asObservable();
private readonly _unregisterIFrameStream: Subject<void> = new Subject();
public readonly unregisterIFrameStream = this._unregisterIFrameStream.asObservable();
private readonly iframes = new Set<HTMLIFrameElement>();
private readonly scripts = new Map<string, HTMLIFrameElement>();
@ -144,6 +147,7 @@ class IframeListener {
}
unregisterIframe(iframe: HTMLIFrameElement): void {
this._unregisterIFrameStream.next();
this.iframes.delete(iframe);
}

View File

@ -914,6 +914,26 @@ ${escapedMessage}
scriptedBubbleSprite.destroy();
}));
iframeListener.unregisterIFrameStream.subscribe(() => {
const allProps = this.gameMap.getCurrentProperties();
if(allProps.get("openWebsite") == null) {
layoutManager.removeActionButton('openWebsite', this.userInputManager);
} else {
const openWebsiteFunction = () => {
coWebsiteManager.loadCoWebsite(allProps.get("openWebsite") as string, this.MapUrlFile, allProps.get('openWebsiteAllowApi') as boolean | undefined, allProps.get('openWebsitePolicy') as string | undefined);
layoutManager.removeActionButton('openWebsite', this.userInputManager);
};
let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES);
if(message === undefined) {
message = 'Press SPACE or touch here to open web site';
}
layoutManager.addActionButton('openWebsite', message.toString(), () => {
openWebsiteFunction();
}, this.userInputManager);
}
})
}
private getMapDirUrl(): string {
@ -1534,6 +1554,33 @@ ${escapedMessage}
mediaManager.showGameOverlay();
mediaManager.removeTriggerCloseJitsiFrameButton('close-jisi');
const allProps = this.gameMap.getCurrentProperties();
if(allProps.get("jitsiRoom") === undefined) {
layoutManager.removeActionButton('jitsiRoom', this.userInputManager);
} else {
const openJitsiRoomFunction = () => {
const roomName = jitsiFactory.getRoomName(allProps.get("jitsiRoom") as string, this.instance);
const jitsiUrl = allProps.get("jitsiUrl") as string | undefined;
if(JITSI_PRIVATE_MODE && !jitsiUrl) {
const adminTag = allProps.get("jitsiRoomAdminTag") as string | undefined;
this.connection?.emitQueryJitsiJwtMessage(roomName, adminTag);
} else {
this.startJitsi(roomName, undefined);
}
layoutManager.removeActionButton('jitsiRoom', this.userInputManager);
}
let message = allProps.get(JITSI_MESSAGE_PROPERTIES);
if(message === undefined) {
message = 'Press SPACE or touch here to enter Jitsi Meet room';
}
layoutManager.addActionButton('jitsiRoom', message.toString(), () => {
openJitsiRoomFunction();
}, this.userInputManager);
}
}
//todo: put this into an 'orchestrator' scene (EntryScene?)

View File

@ -180,6 +180,7 @@ class CoWebsiteManager {
}
setTimeout(() => {
this.cowebsiteMainDom.innerHTML = ``;
HtmlUtils.getElementByIdOrFail(cowebsiteCloseButtonId).blur();
resolve();
}, animationTime)
}));