Type the updater API and the Tauri global. [skip build]
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
MatrixEvent,
|
||||
Room,
|
||||
IPushRules,
|
||||
IPushRule,
|
||||
SyncState,
|
||||
} from 'matrix-js-sdk';
|
||||
import { useAtomValue } from 'jotai';
|
||||
@@ -113,8 +114,8 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
const pushRules = pushRulesEvt?.getContent<IPushRules>() ?? { global: {} };
|
||||
const content = pushRules.global.content ?? [];
|
||||
const keywordPatterns = content
|
||||
.filter((rule: any) => rule.default === false && typeof rule.pattern === 'string')
|
||||
.map((rule: any) => rule.pattern as string);
|
||||
.filter((rule: IPushRule) => rule.default === false && typeof rule.pattern === 'string')
|
||||
.map((rule: IPushRule) => rule.pattern as string);
|
||||
|
||||
// Get notification preferences
|
||||
const global = pushRules?.global;
|
||||
@@ -128,21 +129,21 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
};
|
||||
|
||||
// Check override rules for muted rooms
|
||||
override.forEach((rule: any) => {
|
||||
override.forEach((rule: IPushRule) => {
|
||||
if (isRoomId(rule.rule_id) && getNotificationMode(rule.actions) === NotificationMode.OFF) {
|
||||
preferences.mute.add(rule.rule_id);
|
||||
}
|
||||
});
|
||||
|
||||
// Check room rules for special messages (OFF mode = mentions only)
|
||||
room.forEach((rule: any) => {
|
||||
room.forEach((rule: IPushRule) => {
|
||||
if (getNotificationMode(rule.actions) === NotificationMode.OFF) {
|
||||
preferences.specialMessages.add(rule.rule_id);
|
||||
}
|
||||
});
|
||||
|
||||
// Check room rules for all messages (Notify or NotifyLoud mode)
|
||||
room.forEach((rule: any) => {
|
||||
room.forEach((rule: IPushRule) => {
|
||||
if (getNotificationMode(rule.actions) !== NotificationMode.OFF) {
|
||||
preferences.allMessages.add(rule.rule_id);
|
||||
}
|
||||
@@ -483,7 +484,7 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
|
||||
const content = event.getContent();
|
||||
const isMyReceipt = Object.keys(content).find((eventId) =>
|
||||
(Object.keys(content[eventId]) as any[]).find(
|
||||
Object.keys(content[eventId]).find(
|
||||
(receiptType) => content[eventId][receiptType][myUserId],
|
||||
),
|
||||
);
|
||||
@@ -631,7 +632,7 @@ export function TitleBar({ mx, children }: TitleBarProps) {
|
||||
};
|
||||
|
||||
// Only render on desktop (when Tauri is available)
|
||||
if (typeof (window as any).__TAURI__ === 'undefined') {
|
||||
if (typeof window.__TAURI__ === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user