Skip to content

Commit

Permalink
Merge pull request #19 from muzik-apps/minor-pre-release-bug-patch
Browse files Browse the repository at this point in the history
Update discord_rpc.rs
  • Loading branch information
waveyboym authored Jan 27, 2024
2 parents 9d7c5d8 + 7217298 commit 5287552
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions muzik-offline/src-tauri/src/socials/discord_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ impl DiscordRpc {
}

pub fn set_activity(&mut self, song_name: String, state: String, large_image_key: String) -> Result<(), Box<dyn std::error::Error>> {
//if not connected, attempt to connect
if !self.is_connected {
self.connect()?;
}

if self.allowed_to_connect && self.is_connected {
let activity = activity::Activity::new()
.state(&state)
Expand All @@ -60,6 +65,11 @@ impl DiscordRpc {
}

pub fn clear_activity(&mut self) -> Result<(), Box<dyn std::error::Error>> {
//if not connected, attempt to connect
if !self.is_connected {
self.connect()?;
}

if self.allowed_to_connect && self.is_connected {
self.client.clear_activity()?;
Ok(())
Expand Down

0 comments on commit 5287552

Please sign in to comment.