feat(discord): desktop Discord Rich Presence (reading/TTS activity)#233
feat(discord): desktop Discord Rich Presence (reading/TTS activity)#233anishgoyal1108 wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Publishes the user's current activity to ~/.cache/IReader/discord_state.json via a small file-IPC publisher. A companion standalone bridge (ireader-discord) reads the file and pushes the actual RPC, so IReader takes on no Discord SDK dependency. - ActivityStateHolder (common) + nowMillis() expect/actual (android, desktop). - DiscordStatePublisher (desktop): debounced atomic-rename JSON writer with a 20s heartbeat; deletes the file on Idle so the bridge clears presence. - TTSActivityBridge (desktop): mirrors v2 TTSController playback into the holder so presence shows "Listening" during TTS. - AppTab.displayName: stable, locale-independent tab name for the payload. - Wiring: Koin singles (common holder; desktop publisher+bridge), eager start in Main, browsing-tab hook in MainStarterScreen. - New AppPreferences.discordRichPresenceEnabled() gates startup (default on). iOS actual dropped (upstream removed the iOS target). Reading/perusing presence hooks (reader + book-detail VMs) and a Settings UI toggle are follow-ons.
c047c1f to
7d68ba7
Compare
|
What does this actually do? What's the Idea and need behind this code? |
It's a toggle that lets users display what they're reading in IReader on Discord via the RPC protocol. I'm not at my computer right now to show what the system service I built in Python looks like, but this is the backend to support anyone who wants to build their own service anyway. In my next reply (likely in a couple of weeks), I will showcase the sample Python service and what the result looks like on Discord. |
PR #233 Review: Discord Rich Presence
|
|
I research a little about the discord rich peresence, but this feature needs more thinking |
Description
Adds desktop Discord Rich Presence for reading / TTS activity.
IReader takes on no Discord SDK dependency: it publishes the current activity to
~/.cache/IReader/discord_state.jsonvia a small debounced, atomic-rename filewriter, and a companion standalone bridge (
ireader-discord) reads the file andpushes the actual RPC. Deleting the file on
Idleclears presence.ActivityStateHolder(common) +nowMillis()expect/actual(android, desktop).DiscordStatePublisher(desktop): writer with a 20s heartbeat so a motionlessreading session doesn't go stale.
TTSActivityBridge(desktop): mirrors v2TTSControllerplayback into the holderso presence shows "Listening" during TTS.
AppTab.displayName: stable, locale-independent tab name for the payload.MainStarterScreen.AppPreferences.discordRichPresenceEnabled()gates startup (default on).Type of Change
Testing
"Listening" during TTS; closing IReader clears presence
Additional Notes / open questions
in the separate
ireader-discordPython service, not this repo. Happy to eitherdocument it as a companion install or reimplement the RPC in-app if preferred.
hooks (reader + book-detail VMs) and a Settings UI toggle are intended follow-ons.
actualomitted because upstream removed the iOS target.