matrix-react-sdk
Version:
SDK for matrix.org using React
78 lines (77 loc) • 3.58 kB
TypeScript
import { Room } from "matrix-js-sdk/src/matrix";
import { RoomUpdateCause, TagID } from "./models";
import { ITagMap, ListAlgorithm, SortAlgorithm } from "./algorithms/models";
import { ActionPayload } from "../../dispatcher/payloads";
import { MatrixDispatcher } from "../../dispatcher/dispatcher";
import { IFilterCondition } from "./filters/IFilterCondition";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import { RoomListStore as Interface, RoomListStoreEvent } from "./Interface";
import { SdkContextClass } from "../../contexts/SDKContext";
interface IState {
}
export declare const SlidingSyncSortToFilter: Record<SortAlgorithm, string[]>;
export declare const LISTS_UPDATE_EVENT = RoomListStoreEvent.ListsUpdate;
export declare class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> implements Interface {
private readonly context;
private tagIdToSortAlgo;
private tagMap;
private counts;
private stickyRoomId;
constructor(dis: MatrixDispatcher, context: SdkContextClass);
setTagSorting(tagId: TagID, sort: SortAlgorithm): Promise<void>;
getTagSorting(tagId: TagID): SortAlgorithm;
getCount(tagId: TagID): number;
setListOrder(tagId: TagID, order: ListAlgorithm): void;
getListOrder(tagId: TagID): ListAlgorithm;
/**
* Adds a filter condition to the room list store. Filters may be applied async,
* and thus might not cause an update to the store immediately.
* @param {IFilterCondition} filter The filter condition to add.
*/
addFilter(filter: IFilterCondition): Promise<void>;
/**
* Removes a filter condition from the room list store. If the filter was
* not previously added to the room list store, this will no-op. The effects
* of removing a filter may be applied async and therefore might not cause
* an update right away.
* @param {IFilterCondition} filter The filter condition to remove.
*/
removeFilter(filter: IFilterCondition): void;
/**
* Gets the tags for a room identified by the store. The returned set
* should never be empty, and will contain DefaultTagID.Untagged if
* the store is not aware of any tags.
* @param room The room to get the tags for.
* @returns The tags for the room.
*/
getTagsForRoom(room: Room): TagID[];
/**
* Manually update a room with a given cause. This should only be used if the
* room list store would otherwise be incapable of doing the update itself. Note
* that this may race with the room list's regular operation.
* @param {Room} room The room to update.
* @param {RoomUpdateCause} cause The cause to update for.
*/
manualRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<void>;
get orderedLists(): ITagMap;
private refreshOrderedLists;
private onSlidingSyncListUpdate;
private onRoomViewStoreUpdated;
protected onReady(): Promise<any>;
private onSelectedSpaceUpdated;
resetStore(): Promise<void>;
/**
* Regenerates the room whole room list, discarding any previous results.
*
* Note: This is only exposed externally for the tests. Do not call this from within
* the app.
* @param trigger Set to false to prevent a list update from being sent. Should only
* be used if the calling code will manually trigger the update.
*/
regenerateAllLists({ trigger }: {
trigger?: boolean | undefined;
}): void;
protected onNotReady(): Promise<any>;
protected onAction(payload: ActionPayload): Promise<void>;
}
export {};