Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 28738f1

Browse files
committed
Add new extensions for FOSDEM additions.
1 parent a42f3c3 commit 28738f1

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

src/lifecycles/ClientLifecycle.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright 2025 New Vector Ltd.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/**
18+
* Client lifecycle events
19+
*/
20+
export enum ClientLifecycle {
21+
/**
22+
* An event to notify when the client has completed it's first sync.
23+
*/
24+
FirstSync = "first_sync",
25+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Copyright 2025 New Vector Ltd.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/**
18+
* Extensions that are useful when rebranding the app to be used
19+
* in a conference.
20+
*/
21+
export interface ProvideConferenceExtensions {
22+
filterServerList(servers: string[]): string[];
23+
serverLoginNotice(serverName: string): string | null;
24+
defaultAvatarUrlForString(s: string): string | null;
25+
getAvatarInitialLetter(s: string): string | null;
26+
}
27+
28+
export abstract class ConferenceExtensionsBase implements ProvideConferenceExtensions {
29+
public abstract filterServerList(servers: string[]): string[];
30+
public abstract serverLoginNotice(serverName: string): string | null;
31+
public abstract defaultAvatarUrlForString(s: string): string | null;
32+
public abstract getAvatarInitialLetter(s: string): string | null;
33+
}
34+
35+
export class DefaultConferenceExtensions extends ConferenceExtensionsBase {
36+
public filterServerList(servers: string[]): string[] {
37+
return servers;
38+
}
39+
public serverLoginNotice(): null {
40+
return null;
41+
}
42+
public defaultAvatarUrlForString(): null {
43+
return null;
44+
}
45+
public getAvatarInitialLetter(): null {
46+
return null;
47+
}
48+
}

src/lifecycles/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
Copyright 2025 New Vector Ltd.
34
45
Licensed under the Apache License, Version 2.0 (the "License");
56
you may not use this file except in compliance with the License.
@@ -17,5 +18,6 @@ limitations under the License.
1718
import { RoomViewLifecycle } from "./RoomViewLifecycle";
1819
import { WidgetLifecycle } from "./WidgetLifecycle";
1920
import { WrapperLifecycle } from "./WrapperLifecycle";
21+
import { ClientLifecycle } from "./ClientLifecycle";
2022

21-
export type AnyLifecycle = RoomViewLifecycle | WidgetLifecycle | WrapperLifecycle;
23+
export type AnyLifecycle = RoomViewLifecycle | WidgetLifecycle | WrapperLifecycle | ClientLifecycle;

src/types/extensions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
Copyright 2023 Verji Tech AS
3+
Copyright 2025 New Vector Ltd.
4+
35
Licensed under the Apache License, Version 2.0 (the "License");
46
you may not use this file except in compliance with the License.
57
You may obtain a copy of the License at
@@ -14,11 +16,13 @@ limitations under the License.
1416
*/
1517

1618
import { ProvideBrandingExtensions } from "../lifecycles/BrandingExtensions";
19+
import { ProvideConferenceExtensions } from "../lifecycles/ConferenceExtensions";
1720
import { ProvideCryptoSetupExtensions } from "../lifecycles/CryptoSetupExtensions";
1821
import { ProvideExperimentalExtensions } from "../lifecycles/ExperimentalExtensions";
1922

2023
export type AllExtensions = {
2124
branding?: ProvideBrandingExtensions;
2225
cryptoSetup?: ProvideCryptoSetupExtensions;
2326
experimental?: ProvideExperimentalExtensions;
27+
conference?: ProvideConferenceExtensions;
2428
};

0 commit comments

Comments
 (0)