From 51a95949adb62389fa125e2e6fe2c45e39b70334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Carvalho?= Date: Tue, 11 Aug 2026 07:30:51 -0300 Subject: [PATCH 1/2] fix(rpc): discord rpc proper shutdown when launcher closes (#179) --- src/context/LauncherContext.tsx | 8 ++++++-- src/services/RpcService.ts | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/context/LauncherContext.tsx b/src/context/LauncherContext.tsx index 0e0a7b8..f98acd1 100644 --- a/src/context/LauncherContext.tsx +++ b/src/context/LauncherContext.tsx @@ -7,6 +7,7 @@ import { useSkinSync } from "../hooks/useSkinSync"; import { useDiscordRPC } from "../hooks/useDiscordRPC"; import { useGamepad } from "../hooks/useGamepad"; import { useUpdateCheck } from "../hooks/useUpdateCheck"; +import RpcService from "../services/RpcService"; interface UIContextType { activeView: string; @@ -161,8 +162,11 @@ export function LauncherProvider({ children }: { children: React.ReactNode }) { const setupVisibilityDetection = async () => { try { const { listen } = await import("@tauri-apps/api/event"); - const unlistenClose = await listen("tauri://close-requested", () => { + const unlistenClose = await listen("tauri://close-requested", async () => { setIsWindowVisible(false); + if (config.rpcEnabled) { + await RpcService.StopRPC(); + } }); const unlistenShow = await listen("tauri://window-shown", () => { @@ -190,7 +194,7 @@ export function LauncherProvider({ children }: { children: React.ReactNode }) { }; setupVisibilityDetection(); - }, []); + }, [config.rpcEnabled]); const uiValue = useMemo(() => ({ activeView, setActiveView, showIntro, setShowIntro, diff --git a/src/services/RpcService.ts b/src/services/RpcService.ts index 678cb19..53839d4 100644 --- a/src/services/RpcService.ts +++ b/src/services/RpcService.ts @@ -1,4 +1,4 @@ -import { setActivity, start } from "tauri-plugin-drpc"; +import { setActivity, start, clearActivity, stop } from "tauri-plugin-drpc"; import { Activity, ActivityType, @@ -72,6 +72,19 @@ class RPC { console.error("Failed to set RPC activity:", e); } } + + public async StopRPC() { + try { + await clearActivity(); + await stop(); + } catch (e) { + // no need to handle errors here as the launcher will close anyways! + } finally { + this.initialized = false; + this.initializationPromise = null; + sessionStorage.removeItem("lce_rpc_started"); + } + } } export default new RPC(); From 816997803a26d0dbbeca1eb2d22c437575829a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Carvalho?= Date: Tue, 11 Aug 2026 07:31:19 -0300 Subject: [PATCH 2/2] fix(ClickParticles): clear remaining particles and remove click effects when animations are disabled (#178) --- src/components/common/ClickParticles.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/common/ClickParticles.tsx b/src/components/common/ClickParticles.tsx index 3e0628b..90f6c7b 100644 --- a/src/components/common/ClickParticles.tsx +++ b/src/components/common/ClickParticles.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from "react"; +import { useConfig } from "../../context/LauncherContext"; const SGA_CHARS = "abcdefghijklmnopqrstuvwxyz".split(""); @@ -15,7 +16,11 @@ interface Particle { export const ClickParticles: React.FC = React.memo(() => { const [bursts, setBursts] = useState([]); + const { animationsEnabled } = useConfig(); + useEffect(() => { + if (!animationsEnabled) return; + const handlePressSound = (e: MouseEvent) => { const newParticles: Particle[] = []; const particleCount = 8; @@ -40,8 +45,14 @@ export const ClickParticles: React.FC = React.memo(() => { window.addEventListener("mousedown", handlePressSound); return () => window.removeEventListener("mousedown", handlePressSound); - }, []); + }, [animationsEnabled]); + useEffect(() => { + if (!animationsEnabled) { + setBursts([]); + } + }, [animationsEnabled]) + return (
{bursts.map((p) => (