matrix-react-sdk
Version:
SDK for matrix.org using React
80 lines (79 loc) • 2.62 kB
TypeScript
import React from "react";
import { IAnnotatedPushRule, IPusher, RuleId, IThreepid } from "matrix-js-sdk/src/matrix";
import { IContentRules, VectorState } from "../../../notifications";
import { TranslatedString } from "../../../languageHandler";
declare enum Phase {
Loading = "loading",
Ready = "ready",
Persisting = "persisting",// technically a meta-state for Ready, but whatever
Error = "error",
SavingError = "savingError"
}
declare enum RuleClass {
Master = "master",
VectorGlobal = "vector_global",
VectorMentions = "vector_mentions",
VectorOther = "vector_other",
Other = "other"
}
declare const KEYWORD_RULE_ID = "_keywords";
interface IVectorPushRule {
ruleId: RuleId | typeof KEYWORD_RULE_ID | string;
rule?: IAnnotatedPushRule;
description: TranslatedString | string;
vectorState: VectorState;
syncedVectorState?: VectorState;
}
interface IProps {
}
interface IState {
phase: Phase;
masterPushRule?: IAnnotatedPushRule;
vectorKeywordRuleInfo?: IContentRules;
vectorPushRules?: {
[category in RuleClass]?: IVectorPushRule[];
};
pushers?: IPusher[];
threepids?: IThreepid[];
deviceNotificationsEnabled: boolean;
desktopNotifications: boolean;
desktopShowBody: boolean;
audioNotifications: boolean;
clearingNotifications: boolean;
ruleIdsWithError: Record<RuleId | string, boolean>;
}
/**
* The old, deprecated notifications tab view, only displayed if the user has the labs flag disabled.
*/
export default class Notifications extends React.PureComponent<IProps, IState> {
private settingWatchers;
constructor(props: IProps);
private get isInhibited();
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>): void;
private refreshFromServer;
private refreshFromAccountData;
private persistLocalNotificationSettings;
private refreshRules;
private refreshPushers;
private refreshThreepids;
private showSaveError;
private onMasterRuleChanged;
private setSavingError;
private updateDeviceNotifications;
private onEmailNotificationsChanged;
private onDesktopNotificationsChanged;
private onDesktopShowBodyChanged;
private onAudioNotificationsChanged;
private onRadioChecked;
private onClearNotificationsClicked;
private setKeywords;
private onKeywordAdd;
private onKeywordRemove;
private renderTopSection;
private renderCategory;
private renderTargets;
render(): React.ReactNode;
}
export {};