Closed Toldoven closed 1 year ago
Thank you for these, please make a PR so @sardonicism-04 can merge it into the main branch
Thank you for these, please make a PR so @sardonicism-04 can merge it into the main branch
Basically, I wanted to ask if these features are wanted, and if they are ready to be made into the PR.
Features 1 and 2 are likely are, so yeah, I'll try to polish them, add documentation, and make them into the PR.
1 and 2 look great, will happily merge that PR :)
3 looks like a bit of an unnecessary abstraction IMO
4 sounds interesting. I'll have to think about if something like that is in scope of the project, but would probably not merge it at the moment
1 and 2 look great, will happily merge that PR :)
3 looks like a bit of an unnecessary abstraction IMO
4 sounds interesting. I'll have to think about if something like that is in scope of the project, but would probably not merge it at the moment
Yeah, I agree. 3 is a bit too specific for my desires and 4 is definitely not ready to be merged.
I'll make a PR with 1 and 2 in couple of days. Thanks for the reply.
I did a bit of tinkering on this crate for my project. The implementation is janky, but I've added some features that make it a lot more convenient.
Maybe you can take these ideas and implement them in a better way.
https://github.com/KPidS/tonbun/tree/main/src-tauri/crates/discord-rich-presence
1)
clear_activity
method onDiscordIpc
trait. Basically I implemented solution from #13 into the crate.https://github.com/KPidS/tonbun/blob/main/src-tauri/crates/discord-rich-presence/src/discord_ipc.rs#L212
2) #14
connected
field on theDiscordIpcClient
now actually works. Not sure if it's the right way to implement it though.3)
set_activity_safe
andclear_activity_safe
.https://github.com/KPidS/tonbun/blob/main/src-tauri/crates/discord-rich-presence/src/discord_ipc.rs#L212
Returns
Ok
Ifconnected
is set to false, meaning the client isn't supposed to be connected.If it's true, then tries to set the activity. If
set_activity
returnsErr
it will try to reconnect the client, and returnsErr
only if it failed to reconnect or failed toset_activity
after reconnecting.4)
DiscordIpcClientMutex
struct. Wraps aroundDiscordIpcClient
and hasenable
anddisable
functions.https://github.com/KPidS/tonbun/blob/main/src-tauri/crates/discord-rich-presence/src/discord_ipc_mutex.rs
enable
will start an interval that is constantly going to try to connect to the client, so you don't have to worry about manually connecting it ever.This is definitely WIP at the moment, since I need to implement a proper way to stop the interval thread when you
disable
it.Right now if you spam
enable
disable
you can launch multiple threads at the same time.