Skip to content

Commit b213efd

Browse files
authored
feat(deps): update discord-rich-presence to 1.0.0 (#170)
2 parents e7f7a00 + 69ccc4f commit b213efd

4 files changed

Lines changed: 137 additions & 64 deletions

File tree

Cargo.lock

Lines changed: 120 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readme = "README.md"
1111
exclude = [".github/*", "docs/*.psd", "credentials.ini", ".gitignore"]
1212

1313
[dependencies]
14-
discord-rich-presence = "0.2.5"
14+
discord-rich-presence = "1.0.0"
1515
ureq = { version = "2.12.1", features = ["json"] }
1616
configparser = { version = "3.1.0", features = ["indexmap"] }
1717
serde = { version = "1.0.228", features = ["derive"] }
@@ -37,7 +37,7 @@ tray-icon = "0.19"
3737
ksni = { version = "0.3", features = ["blocking"] }
3838

3939
[target.'cfg(target_os = "macos")'.dependencies]
40-
objc2-app-kit = "0.2"
40+
objc2-app-kit = "0.3"
4141
objc2-foundation = "0.3"
4242

4343
[target.'cfg(target_os = "windows")'.build-dependencies]

src/discord.rs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,17 @@ pub struct Payload {
2828
}
2929

3030
impl Discord {
31-
pub fn new(discord_client_id: String) -> Result<Discord, Box<dyn std::error::Error>> {
32-
let client = DiscordIpcClient::new(&discord_client_id).map_err(|e| {
33-
tracing::error!("Couldn't create Discord client: {e}");
34-
e
35-
})?;
36-
Ok(Discord {
37-
client,
31+
pub fn new(discord_client_id: String) -> Discord {
32+
Discord {
33+
client: DiscordIpcClient::new(&discord_client_id),
3834
current_app_id: discord_client_id,
39-
})
35+
}
4036
}
4137

4238
/// Switch to a different Discord application ID if needed.
43-
/// Returns true if a switch occurred.
44-
fn switch_app_id(&mut self, new_app_id: &str) -> bool {
39+
fn switch_app_id(&mut self, new_app_id: &str) {
4540
if self.current_app_id == new_app_id {
46-
return false;
41+
return;
4742
}
4843

4944
tracing::info!(
@@ -56,18 +51,9 @@ impl Discord {
5651
let _ = self.client.close();
5752

5853
// Create new client with new app ID
59-
match DiscordIpcClient::new(new_app_id) {
60-
Ok(new_client) => {
61-
self.client = new_client;
62-
self.current_app_id = new_app_id.to_string();
63-
self.connect();
64-
true
65-
}
66-
Err(e) => {
67-
tracing::error!("Failed to create Discord client with new app ID: {e}");
68-
false
69-
}
70-
}
54+
self.client = DiscordIpcClient::new(new_app_id);
55+
self.current_app_id = new_app_id.to_string();
56+
self.connect();
7157
}
7258

7359
pub fn connect(&mut self) {

0 commit comments

Comments
 (0)