Type the electron and matrix plugin call sites instead of any. [skip build]
Checks / checks (push) Successful in 2m7s
Trigger cinny-mobile / dispatch (push) Successful in 2s

This commit is contained in:
2026-11-01 22:08:24 +11:00
parent eaa9ac00dd
commit 3781b05f6f
4 changed files with 67 additions and 54 deletions
+31 -25
View File
@@ -1,3 +1,4 @@
import { EncryptedAttachmentInfo } from 'browser-encrypt-attachment';
import { useAtomValue } from 'jotai';
import React, { ReactNode, useCallback, useEffect, useRef, useState, Fragment } from 'react';
import { useNavigate } from 'react-router-dom';
@@ -137,10 +138,11 @@ function InviteNotifications() {
(count: number) => {
const body = `You have ${count} new invitation request.`;
const invitesPath = getInboxInvitesPath();
const { electron } = window;
// 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
if (isElectron() && electron?.window?.flashFrame) {
electron.window
.flashFrame(true)
.then((result: { success: boolean }) => {
console.log('[InviteNotifications] flashFrame result:', result);
@@ -172,8 +174,8 @@ function InviteNotifications() {
if (!window.closed) navigate(invitesPath);
noti.close();
// Stop flashing when user clicks notification
if ((window as any).electron?.window?.flashFrame) {
(window as any).electron.window.flashFrame(false);
if (electron?.window?.flashFrame) {
electron.window.flashFrame(false);
}
};
}
@@ -183,12 +185,13 @@ function InviteNotifications() {
const playSound = useCallback(() => {
console.log('[InviteNotifications] playSound called, isElectron:', isElectron());
if (isElectron() && (window as any).electron?.audio?.playNotificationSound) {
const { electron } = window;
if (isElectron() && electron?.audio?.playNotificationSound) {
console.log('[InviteNotifications] Using Electron audio API');
(window as any).electron.audio
electron.audio
.playNotificationSound('invite')
.then((result: any) => console.log('[InviteNotifications] Sound result:', result))
.catch((err: any) => console.error('[InviteNotifications] Sound error:', err));
.then((result) => console.log('[InviteNotifications] Sound result:', result))
.catch((err) => console.error('[InviteNotifications] Sound error:', err));
} else {
console.log('[InviteNotifications] Using HTML5 Audio fallback');
new Audio('./sound/invite.ogg').play().catch((err) => {
@@ -252,6 +255,7 @@ function MessageNotifications() {
}) => {
const notificationTitle = username;
const notificationBody = messageBody || 'New message';
const { electron } = window;
/** Replicates TitleBar click navigation logic */
const navigateToRoom = () => {
@@ -277,8 +281,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
if (isElectron() && electron?.window?.flashFrame) {
electron.window
.flashFrame(true)
.then((result: { success: boolean }) => {
console.log('[Notifications] flashFrame result:', result);
@@ -316,13 +320,13 @@ function MessageNotifications() {
noti.onclick = () => {
// Tell main process to bring window to front
(window as any).electron?.window?.focus();
electron?.window?.focus();
if (!window.closed) navigateToRoom();
noti.close();
notifRef.current = undefined;
// Stop flashing when user clicks notification
if ((window as any).electron?.window?.flashFrame) {
(window as any).electron.window.flashFrame(false);
if (electron?.window?.flashFrame) {
electron.window.flashFrame(false);
}
};
@@ -335,12 +339,13 @@ function MessageNotifications() {
const playSound = useCallback(() => {
console.log('[MessageNotifications] playSound called, isElectron:', isElectron());
if (isElectron() && (window as any).electron?.audio?.playNotificationSound) {
const { electron } = window;
if (isElectron() && electron?.audio?.playNotificationSound) {
console.log('[MessageNotifications] Using Electron audio API');
(window as any).electron.audio
electron.audio
.playNotificationSound('message')
.then((result: any) => console.log('[MessageNotifications] Sound result:', result))
.catch((err: any) => console.error('[MessageNotifications] Sound error:', err));
.then((result) => console.log('[MessageNotifications] Sound result:', result))
.catch((err) => console.error('[MessageNotifications] Sound error:', err));
} else {
console.log('[MessageNotifications] Using HTML5 Audio fallback');
new Audio('./sound/notification.ogg').play().catch((err) => {
@@ -503,18 +508,19 @@ function PaarrotAPIInitializer() {
*/
function TaskbarFlashStopper() {
useEffect(() => {
const { electron } = window;
// Log what's available on mount
console.log('[TaskbarFlashStopper] window.electron:', (window as any).electron);
console.log('[TaskbarFlashStopper] window.electron:', electron);
console.log('[TaskbarFlashStopper] Available APIs:', {
hasWindow: !!(window as any).electron?.window,
hasFlashFrame: !!(window as any).electron?.window?.flashFrame,
hasAudio: !!(window as any).electron?.audio,
hasPlaySound: !!(window as any).electron?.audio?.playNotificationSound,
hasWindow: !!electron?.window,
hasFlashFrame: !!electron?.window?.flashFrame,
hasAudio: !!electron?.audio,
hasPlaySound: !!electron?.audio?.playNotificationSound,
});
const handleFocus = () => {
if ((window as any).electron?.window?.flashFrame) {
(window as any).electron.window.flashFrame(false);
if (electron?.window?.flashFrame) {
electron.window.flashFrame(false);
}
};
@@ -558,7 +564,7 @@ function AndroidShareIntentHandler() {
const originalFile = await materializeSharedFile(sharedFile, share.receivedAt);
let fileToUpload = originalFile;
let encInfo: any;
let encInfo: EncryptedAttachmentInfo | undefined;
if (room.hasEncryptionStateEvent()) {
const encrypted = await encryptFile(originalFile);