Fix Android media downloads and dismiss notifs when read elsewhere.
All checks were successful
Build / increment-version (push) Successful in 5s
Build / build-android (push) Successful in 5m5s

FileSaver fails in Capacitor WebView, so save via MediaStore; clear tray notifications when sync reports rooms as read on another device, and improve collapsed notification avatars with conversation shortcuts.
This commit is contained in:
2026-07-24 15:26:31 +10:00
parent a4d56e095e
commit 8cf31b929d
10 changed files with 1210 additions and 25 deletions

View File

@@ -425,16 +425,30 @@ function MessageNotifications() {
const roomToUnread = useAtomValue(roomToUnreadAtom);
const previousUnreadRoomsRef = useRef<Set<string>>(new Set());
const previousUnreadTotalsRef = useRef<Map<string, number>>(new Map());
// Dismiss OS notifications when a room's unread is cleared (local read or receipt).
// Dismiss OS notifications when a room's unread is cleared
// (local mark-as-read, or our receipt syncing from another device).
useEffect(() => {
const currentRooms = new Set(roomToUnread.keys());
const nextTotals = new Map<string, number>();
roomToUnread.forEach((unread, roomId) => {
nextTotals.set(roomId, unread.total);
const prevTotal = previousUnreadTotalsRef.current.get(roomId);
if (prevTotal !== undefined && prevTotal > 0 && unread.total === 0) {
void clearNotificationsForRoom(roomId);
}
});
for (const roomId of previousUnreadRoomsRef.current) {
if (!currentRooms.has(roomId)) {
void clearNotificationsForRoom(roomId);
}
}
previousUnreadRoomsRef.current = currentRooms;
previousUnreadTotalsRef.current = nextTotals;
}, [roomToUnread]);
const notify = useCallback(