fix: re-adding send image listener

wip

fix: re-adding send image listener
This commit is contained in:
2025-07-18 15:48:38 +01:00
parent 510cb3012b
commit ec18cb0ee0
2 changed files with 34 additions and 0 deletions

View File

@ -13,9 +13,11 @@ import { WithNotifications } from "@contexts/Notifications";
import { ProtectedRoute } from "@components/protected-route";
import { AppWrapper } from "@components/app-wrapper";
import { WithTopbarAndDock } from "@components/app-wrapper/with-topbar-and-dock";
import { onSendImage } from "@contexts/send-image";
export const App = () => {
onAndroidMount();
onSendImage();
return (
<SearchImageContextProvider>

View File

@ -0,0 +1,32 @@
import { createEffect } from "solid-js";
import { listen } from "@tauri-apps/api/event";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { sendImage } from "@network/index";
export const onSendImage = () => {
let sentImage = "";
createEffect(async () => {
// Listen for PNG processing events
const unlisten = listen("png-processed", async (event) => {
const base64Data = event.payload as string;
if (base64Data === sentImage) {
return;
}
sentImage = base64Data;
const appWindow = getCurrentWindow();
appWindow.show();
appWindow.setFocus();
await sendImage("test-image.png", base64Data);
});
return () => {
unlisten.then((fn) => fn()); // Cleanup listener
};
});
};