Skip to content

Commit

Permalink
review (implement interface, make interface internal, dont change pub…
Browse files Browse the repository at this point in the history
…lic api.)
  • Loading branch information
toger5 committed Jan 10, 2025
1 parent ce420c9 commit 2ea4f01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/matrixrtc/MatrixRTCSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,14 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
private isMyMembership = (m: CallMembership): boolean =>
m.sender === this.client.getUserId() && m.deviceId === this.client.getDeviceId();

/**
* @deprecated use onMembershipsUpdate instead. this should be called when any membership in the call is updated
* the old name might have implied to only need to call this when your own membership changes.
*/
public onMembershipUpdate = (): void => {
this.onMembershipsUpdate();
};

/**
* Examines the latest call memberships and handles any encryption key sending or rotation that is needed.
*
Expand Down
10 changes: 8 additions & 2 deletions src/matrixrtc/MembershipManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import { CallMembership, DEFAULT_EXPIRE_DURATION, SessionMembershipData } from "
import { Focus } from "./focus.ts";
import { isLivekitFocusActive } from "./LivekitFocus.ts";
import { MembershipConfig } from "./MatrixRTCSession.ts";

/**
* This interface defines what a MembershipManager uses and exposes.
* This interface is what we use to write tests and allows to change the actual implementation
* Without breaking tests because of some internal method renaming.
*
* @internal
*/
export abstract class MembershipManagerInterface {
public constructor(
joinConfig: MembershipConfig | undefined,
Expand Down Expand Up @@ -48,7 +54,7 @@ export abstract class MembershipManagerInterface {
*
* @internal
*/
export class MembershipManager {
export class MembershipManager implements MembershipManagerInterface {
private relativeExpiry: number | undefined;

private memberEventTimeout?: ReturnType<typeof setTimeout>;
Expand Down

0 comments on commit 2ea4f01

Please sign in to comment.