New group call experience: Call tiles (#9332)
* Add call tiles * Factor CallDuration out into a reusable component * Correct the separator character in LiveContentSummary
This commit is contained in:
parent
07a5a1dc6f
commit
ff59f68a9f
19 changed files with 606 additions and 51 deletions
|
@ -18,17 +18,18 @@ import { MatrixWidgetType } from "matrix-widget-api";
|
|||
|
||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { mkEvent } from "./test-utils";
|
||||
import { Call, ElementCall, JitsiCall } from "../../src/models/Call";
|
||||
|
||||
export class MockedCall extends Call {
|
||||
private static EVENT_TYPE = "org.example.mocked_call";
|
||||
public static readonly EVENT_TYPE = "org.example.mocked_call";
|
||||
public readonly STUCK_DEVICE_TIMEOUT_MS = 1000 * 60 * 60; // 1 hour
|
||||
|
||||
private constructor(room: Room, id: string) {
|
||||
private constructor(room: Room, public readonly event: MatrixEvent) {
|
||||
super(
|
||||
{
|
||||
id,
|
||||
id: event.getStateKey()!,
|
||||
eventId: "$1:example.org",
|
||||
roomId: room.roomId,
|
||||
type: MatrixWidgetType.Custom,
|
||||
|
@ -42,7 +43,9 @@ export class MockedCall extends Call {
|
|||
|
||||
public static get(room: Room): MockedCall | null {
|
||||
const [event] = room.currentState.getStateEvents(this.EVENT_TYPE);
|
||||
return event?.getContent().terminated ?? true ? null : new MockedCall(room, event.getStateKey()!);
|
||||
return (event === undefined || "m.terminated" in event.getContent())
|
||||
? null
|
||||
: new MockedCall(room, event);
|
||||
}
|
||||
|
||||
public static create(room: Room, id: string) {
|
||||
|
@ -52,8 +55,9 @@ export class MockedCall extends Call {
|
|||
type: this.EVENT_TYPE,
|
||||
room: room.roomId,
|
||||
user: "@alice:example.org",
|
||||
content: { terminated: false },
|
||||
content: { "m.type": "m.video", "m.intent": "m.prompt" },
|
||||
skey: id,
|
||||
ts: Date.now(),
|
||||
})]);
|
||||
}
|
||||
|
||||
|
@ -78,8 +82,9 @@ export class MockedCall extends Call {
|
|||
type: MockedCall.EVENT_TYPE,
|
||||
room: this.room.roomId,
|
||||
user: "@alice:example.org",
|
||||
content: { terminated: true },
|
||||
content: { ...this.event.getContent(), "m.terminated": "Call ended" },
|
||||
skey: this.widget.id,
|
||||
ts: Date.now(),
|
||||
})]);
|
||||
|
||||
super.destroy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue