Apply the auto-fixable lint rules and the formatter, and drop the Vite build artifacts.
Checks / checks (push) Successful in 2m11s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-01 04:23:53 +11:00
parent 3cd159a63e
commit a6ad8651b3
605 changed files with 11480 additions and 9125 deletions
+38 -32
View File
@@ -1,5 +1,4 @@
import { useAtomValue } from 'jotai';
import { useAtom, useSetAtom } from 'jotai';
import { useAtomValue, useAtom, useSetAtom } from 'jotai';
import React, { ReactNode, useCallback, useEffect, useRef, useState, Fragment } from 'react';
import { useNavigate } from 'react-router-dom';
import { RoomEvent, RoomEventHandlerMap } from 'matrix-js-sdk';
@@ -13,7 +12,12 @@ import { EmojiStyle, settingsAtom } from '../../state/settings';
import { allInvitesAtom } from '../../state/room-list/inviteList';
import { usePreviousValue } from '../../hooks/usePreviousValue';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { getDirectRoomPath, getHomeRoomPath, getSpaceRoomPath, getInboxInvitesPath } from '../pathUtils';
import {
getDirectRoomPath,
getHomeRoomPath,
getSpaceRoomPath,
getInboxInvitesPath,
} from '../pathUtils';
import {
getMemberDisplayName,
getNotificationType,
@@ -23,7 +27,12 @@ import {
guessPerfectParent,
} from '../../utils/room';
import { NotificationType, UnreadInfo } from '../../../types/matrix/room';
import { getMxIdLocalPart, mxcUrlToHttp, getCanonicalAliasOrRoomId } from '../../utils/matrix';
import {
getMxIdLocalPart,
mxcUrlToHttp,
getCanonicalAliasOrRoomId,
encryptFile,
} from '../../utils/matrix';
import { mDirectAtom } from '../../state/mDirectList';
import { roomToParentsAtom } from '../../state/room/roomToParents';
import { useSelectedRoom } from '../../hooks/router/useSelectedRoom';
@@ -49,7 +58,6 @@ import {
roomIdToMsgDraftAtomFamily,
roomIdToUploadItemsAtomFamily,
} from '../../state/room/roomInputDrafts';
import { encryptFile } from '../../utils/matrix';
import {
AndroidSharePayload,
clearPendingAndroidShare,
@@ -135,10 +143,11 @@ function InviteNotifications() {
(count: number) => {
const body = `You have ${count} new invitation request.`;
const invitesPath = getInboxInvitesPath();
// Flash taskbar icon for desktop notifications (only visible when window is not focused)
if (isElectron() && (window as any).electron?.window?.flashFrame) {
(window as any).electron.window.flashFrame(true)
(window as any).electron.window
.flashFrame(true)
.then((result: { success: boolean }) => {
console.log('[InviteNotifications] flashFrame result:', result);
})
@@ -146,7 +155,7 @@ function InviteNotifications() {
console.error('[InviteNotifications] flashFrame error:', err);
});
}
if ((isTauri() && !isElectron()) || isCapacitorNative()) {
sendNotification({
title: 'Invitation',
@@ -175,14 +184,15 @@ function InviteNotifications() {
};
}
},
[navigate]
[navigate],
);
const playSound = useCallback(() => {
console.log('[InviteNotifications] playSound called, isElectron:', isElectron());
if (isElectron() && (window as any).electron?.audio?.playNotificationSound) {
console.log('[InviteNotifications] Using Electron audio API');
(window as any).electron.audio.playNotificationSound('invite')
(window as any).electron.audio
.playNotificationSound('invite')
.then((result: any) => console.log('[InviteNotifications] Sound result:', result))
.catch((err: any) => console.error('[InviteNotifications] Sound error:', err));
} else {
@@ -275,7 +285,8 @@ function MessageNotifications() {
// Flash taskbar icon for desktop notifications (only visible when window is not focused)
console.log('[Notifications] Attempting flashFrame');
if (isElectron() && (window as any).electron?.window?.flashFrame) {
(window as any).electron.window.flashFrame(true)
(window as any).electron.window
.flashFrame(true)
.then((result: { success: boolean }) => {
console.log('[Notifications] flashFrame result:', result);
})
@@ -285,7 +296,7 @@ function MessageNotifications() {
} else {
console.warn('[Notifications] flashFrame not available, isElectron:', isElectron());
}
if ((isTauri() && !isElectron()) || isCapacitorNative()) {
const roomPath = isDm
? getDirectRoomPath(roomId, eventId)
@@ -326,14 +337,15 @@ function MessageNotifications() {
notifRef.current = noti;
}
},
[mx, navigate, mDirects, roomToParents]
[mx, navigate, mDirects, roomToParents],
);
const playSound = useCallback(() => {
console.log('[MessageNotifications] playSound called, isElectron:', isElectron());
if (isElectron() && (window as any).electron?.audio?.playNotificationSound) {
console.log('[MessageNotifications] Using Electron audio API');
(window as any).electron.audio.playNotificationSound('message')
(window as any).electron.audio
.playNotificationSound('message')
.then((result: any) => console.log('[MessageNotifications] Sound result:', result))
.catch((err: any) => console.error('[MessageNotifications] Sound error:', err));
} else {
@@ -350,7 +362,7 @@ function MessageNotifications() {
room,
toStartOfTimeline,
removed,
data
data,
) => {
if (mx.getSyncState() !== 'SYNCING') return;
if (document.hasFocus() && (selectedRoomId === room?.roomId || notificationSelected)) return;
@@ -394,7 +406,7 @@ function MessageNotifications() {
const avatarMxc =
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
const content = mEvent.getContent();
let messageBody: string | undefined;
if (mEvent.getType() === 'm.reaction') {
// For reactions, show "reacted with {emoji}"
@@ -407,11 +419,11 @@ function MessageNotifications() {
} else {
messageBody = typeof content.body === 'string' ? content.body : undefined;
}
notify({
roomName: room.name ?? 'Unknown',
roomAvatar: avatarMxc
? mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined)
: undefined,
username: getMemberDisplayName(room, sender) ?? getMxIdLocalPart(sender) ?? sender,
messageBody,
@@ -483,10 +495,10 @@ function PaarrotAPIInitializer() {
useEffect(() => {
// Register navigate function for Paarrot API
setPaarrotNavigate(navigate);
// Initialize Paarrot API handlers
initPaarrotAPI(mx);
console.log('Paarrot API: Initialized with navigate function');
}, [navigate, mx]);
@@ -536,7 +548,7 @@ function AndroidShareIntentHandler() {
// Send text message if present
const nextParts = [share.subject?.trim(), share.text?.trim()].filter(
(value): value is string => !!value
(value): value is string => !!value,
);
if (nextParts.length > 0) {
const textContent = {
@@ -550,7 +562,7 @@ function AndroidShareIntentHandler() {
if (share.files.length > 0) {
for (const sharedFile of share.files) {
const originalFile = await materializeSharedFile(sharedFile, share.receivedAt);
let fileToUpload = originalFile;
let encInfo: any;
@@ -598,7 +610,7 @@ function AndroidShareIntentHandler() {
await clearPendingAndroidShare();
return true;
},
[mx]
[mx],
);
const handlePickRoom = useCallback(
@@ -609,7 +621,7 @@ function AndroidShareIntentHandler() {
.then((applied) => {
if (applied) {
setPendingShare(null);
// Navigate to the selected room
const isDirect = mDirects.has(roomId);
if (isDirect) {
@@ -630,7 +642,7 @@ function AndroidShareIntentHandler() {
setPendingShare(null);
});
},
[applyPendingShare, pendingShare, navigate, mDirects, roomToParents]
[applyPendingShare, pendingShare, navigate, mDirects, roomToParents],
);
const handleDismiss = useCallback(() => {
@@ -674,13 +686,7 @@ function AndroidShareIntentHandler() {
if (!pendingShare) return null;
return (
<ShareRoomPicker
share={pendingShare}
onPick={handlePickRoom}
onDismiss={handleDismiss}
/>
);
return <ShareRoomPicker share={pendingShare} onPick={handlePickRoom} onDismiss={handleDismiss} />;
}
type ClientNonUIFeaturesProps = {