matrix-react-sdk
Version:
SDK for matrix.org using React
72 lines (71 loc) • 2.31 kB
TypeScript
import { TypedEventEmitter } from "matrix-js-sdk/src/matrix";
/**
* The features are shown in the array order.
*/
declare const FEATURES: readonly ["threadsActivityCentre", "pinningMessageList"];
/**
* All the features that can be shown in the release announcements.
*/
export type Feature = (typeof FEATURES)[number];
/**
* The events emitted by the ReleaseAnnouncementStore.
*/
type ReleaseAnnouncementStoreEvents = "releaseAnnouncementChanged";
/**
* The handlers for the ReleaseAnnouncementStore events.
*/
type HandlerMap = {
releaseAnnouncementChanged: (newFeature: Feature | null) => void;
};
/**
* The ReleaseAnnouncementStore is responsible for managing the release announcements.
* It keeps track of the viewed release announcements and emits events when the release announcement changes.
*/
export declare class ReleaseAnnouncementStore extends TypedEventEmitter<ReleaseAnnouncementStoreEvents, HandlerMap> {
/**
* The singleton instance of the ReleaseAnnouncementStore.
* @private
*/
private static internalInstance;
/**
* The index of the feature to show.
* @private
*/
private index;
/**
* The singleton instance of the ReleaseAnnouncementStore.
*/
static get instance(): ReleaseAnnouncementStore;
/**
* Should be used only for testing purposes.
* @internal
*/
constructor();
/**
* Get the viewed release announcements from the settings.
* @private
*/
private getViewedReleaseAnnouncements;
/**
* Check if the release announcement is enabled.
* @private
*/
private isReleaseAnnouncementEnabled;
/**
* Get the release announcement that should be displayed
* @returns The feature to announce or null if there is no feature to announce
*/
getReleaseAnnouncement(): Feature | null;
/**
* Mark the current release announcement as viewed.
* This will update the account settings
* @private
*/
private markReleaseAnnouncementAsViewed;
/**
* Mark the current release announcement as viewed and move to the next release announcement.
* This will update the account settings and emit the `releaseAnnouncementChanged` event
*/
nextReleaseAnnouncement(): Promise<void>;
}
export {};