Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions opennow-stable/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,10 @@ function registerIpcHandlers(): void {
return getActiveSessions(jwt, baseUrl);
});

ipcMain.handle(IPC_CHANNELS.DISCORD_CLEAR_ACTIVITY, async () => {
void clearActivity();
});

ipcMain.handle(IPC_CHANNELS.CLAIM_SESSION, async (_event, payload: SessionClaimRequest) => {
try {
const token = await resolveJwt(payload.token);
Expand Down
1 change: 1 addition & 0 deletions opennow-stable/src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const api: OpenNowApi = {
fetchPrintedWasteServerMapping: (): Promise<PrintedWasteServerMapping> =>
ipcRenderer.invoke(IPC_CHANNELS.PRINTEDWASTE_SERVER_MAPPING_FETCH),
getThanksData: (): Promise<ThankYouDataResult> => ipcRenderer.invoke(IPC_CHANNELS.COMMUNITY_GET_THANKS),
clearDiscordActivity: (): Promise<void> => ipcRenderer.invoke(IPC_CHANNELS.DISCORD_CLEAR_ACTIVITY),
};

contextBridge.exposeInMainWorld("openNow", api);
7 changes: 6 additions & 1 deletion opennow-stable/src/renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,12 @@ export function App(): JSX.Element {
if (!options?.keepLaunchError) {
setLaunchError(null);
}
}, [diagnosticsStore, resetStatsOverlayToPreference]);

// Clear Discord activity when returning to idle state
if (settings.discordRichPresence) {
void window.openNow.clearDiscordActivity();
}
}, [diagnosticsStore, resetStatsOverlayToPreference, settings.discordRichPresence]);

// Session ref sync
useEffect(() => {
Expand Down
2 changes: 2 additions & 0 deletions opennow-stable/src/shared/gfn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ export interface OpenNowApi {
/** Fetch PrintedWaste server mapping metadata (includes nuked status) */
fetchPrintedWasteServerMapping(): Promise<PrintedWasteServerMapping>;
getThanksData(): Promise<ThankYouDataResult>;
/** Clear Discord rich presence activity */
clearDiscordActivity(): Promise<void>;
}

export interface ScreenshotSaveRequest {
Expand Down
2 changes: 2 additions & 0 deletions opennow-stable/src/shared/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export const IPC_CHANNELS = {
// PrintedWaste queue integration
PRINTEDWASTE_QUEUE_FETCH: "printedwaste:queue-fetch",
PRINTEDWASTE_SERVER_MAPPING_FETCH: "printedwaste:server-mapping-fetch",
// Discord Rich Presence
DISCORD_CLEAR_ACTIVITY: "discord:clear-activity",
} as const;

export type IpcChannel = (typeof IPC_CHANNELS)[keyof typeof IPC_CHANNELS];
Loading