refactor(notifications): simplify keywords to add/remove, dropping the per-keyword loudness control
This commit is contained in:
parent
94bc35092a
commit
a3a8655487
1 changed files with 0 additions and 24 deletions
|
|
@ -12,9 +12,7 @@ import {
|
|||
getNotificationModeActions,
|
||||
NotificationMode,
|
||||
NotificationModeOptions,
|
||||
useNotificationModeActions,
|
||||
} from '../../../hooks/useNotificationMode';
|
||||
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
|
||||
import { AsyncStatus, useAsyncCallback } from '../../../hooks/useAsyncCallback';
|
||||
|
||||
const NOTIFY_MODE_OPS: NotificationModeOptions = {
|
||||
|
|
@ -126,27 +124,6 @@ function KeywordCross({ pushRule }: PushRulesProps) {
|
|||
);
|
||||
}
|
||||
|
||||
function KeywordModeSwitcher({ pushRule }: PushRulesProps) {
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const getModeActions = useNotificationModeActions(NOTIFY_MODE_OPS);
|
||||
|
||||
const handleChange = useCallback(
|
||||
async (mode: NotificationMode) => {
|
||||
const actions = getModeActions(mode);
|
||||
await mx.setPushRuleActions(
|
||||
'global',
|
||||
PushRuleKind.ContentSpecific,
|
||||
pushRule.rule_id,
|
||||
actions
|
||||
);
|
||||
},
|
||||
[mx, getModeActions, pushRule]
|
||||
);
|
||||
|
||||
return <NotificationModeSwitcher pushRule={pushRule} onChange={handleChange} />;
|
||||
}
|
||||
|
||||
export function KeywordMessagesNotifications() {
|
||||
const { t } = useTranslation();
|
||||
const pushRulesEvt = useAccountData(AccountDataEvent.PushRules);
|
||||
|
|
@ -179,7 +156,6 @@ export function KeywordMessagesNotifications() {
|
|||
</Text>
|
||||
}
|
||||
before={<KeywordCross pushRule={pushRule} />}
|
||||
after={<KeywordModeSwitcher pushRule={pushRule} />}
|
||||
/>
|
||||
))}
|
||||
</SettingsSection>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue