Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/lifecycles/BrandingExtensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interface AppTitleBase {
/**
* The configured brand name.
* @example Element
*/
brand: string;
/**
* Is the client sync loop in an error state.
*/
syncError: boolean;
/**
* The current unread notification count.
*/
unreadNotificationCount?: number;
/**
* Has the client muted notifications.
*/
notificationsMuted?: boolean;
}

export interface AppTitleInRoom extends AppTitleBase {
/**
* The room name, may be undefined if the room has no name.
*/
roomName?: string;
/**
* The room ID of the room in view.
*/
roomId: string;
}

export type AppTitleContext = AppTitleBase | AppTitleInRoom;

export interface ProvideBrandingExtensions {
/**
* Called whenever the client would update the document title.
* @param context Current application context used to generate the title.
* @returns A string to be used for the full title, or null to use the default title.
*/
getAppTitle(context: AppTitleContext): string | null;
}

export abstract class BrandingExtensionsBase implements ProvideBrandingExtensions {
public getAppTitle(context: AppTitleContext): string | null {
return null;
}
}
2 changes: 2 additions & 0 deletions src/types/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { ProvideBrandingExtensions } from "../lifecycles/BrandingExtensions";
import { ProvideCryptoSetupExtensions } from "../lifecycles/CryptoSetupExtensions";
import { ProvideExperimentalExtensions } from "../lifecycles/ExperimentalExtensions";

export type AllExtensions = {
branding?: ProvideBrandingExtensions;
cryptoSetup?: ProvideCryptoSetupExtensions;
experimental?: ProvideExperimentalExtensions;
};
Loading