diff --git a/frontend/iframe/viewmodels/SessionViewModel.ts b/frontend/iframe/viewmodels/SessionViewModel.ts index 04956e0..945440b 100644 --- a/frontend/iframe/viewmodels/SessionViewModel.ts +++ b/frontend/iframe/viewmodels/SessionViewModel.ts @@ -1,5 +1,6 @@ import { SessionViewModel as BaseSessionViewModel } from "hydrogen-web/src/domain/session/SessionViewModel"; import { RoomViewModel } from "./RoomViewModel"; +import { UnknownRoomViewModel } from "./UnknownRoomVideoModel"; import { SettingsViewModel } from "./SettingsViewModel"; export class SessionViewModel extends BaseSessionViewModel { @@ -110,4 +111,14 @@ export class SessionViewModel extends BaseSessionViewModel { } return null; } + + async _createUnknownRoomViewModel(roomIdOrAlias, isWorldReadablePromise) { + return new UnknownRoomViewModel(super.childOptions({ + roomIdOrAlias, + session: this.client.session, + isWorldReadablePromise: isWorldReadablePromise, + guestJoinAllowed: false, + singleRoomId: this._singleRoomId, + })); + } } diff --git a/frontend/iframe/viewmodels/UnknownRoomVideoModel.ts b/frontend/iframe/viewmodels/UnknownRoomVideoModel.ts new file mode 100644 index 0000000..708b2de --- /dev/null +++ b/frontend/iframe/viewmodels/UnknownRoomVideoModel.ts @@ -0,0 +1,29 @@ +import {UnknownRoomViewModel as BaseUnknownRoomViewModel} from "hydrogen-web/src/domain/session/room/UnknownRoomViewModel"; +import {SegmentType} from "hydrogen-web/src/domain/navigation"; +import {Segment} from "hydrogen-web/src/domain/navigation/Navigation"; + +export class UnknownRoomViewModel extends BaseUnknownRoomViewModel { + private readonly _singleRoomId: any; + + constructor(options) { + super(options); + this._singleRoomId = options.singleRoomId; + } + + get navigation() { + return super.navigation; + } + + get urlRouter() { + return super.urlRouter; + } + + get closeUrl() { + if (this._singleRoomId) { + const path = this.navigation.path.with(new Segment("session")); + return this.urlRouter.urlForPath(path); + } + + return super.closeUrl; + } +}