From 55d110493aad7797282fcb827648d1df3e8a9386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 2 Nov 2024 21:31:45 +0100 Subject: [PATCH] Hide the Discord Rich Presence option on platforms where we don't support it --- UI/DiscordIntegration.cpp | 8 ++++++++ UI/DiscordIntegration.h | 2 ++ UI/GameSettingsScreen.cpp | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/UI/DiscordIntegration.cpp b/UI/DiscordIntegration.cpp index 748547c2a0..85458b1f32 100644 --- a/UI/DiscordIntegration.cpp +++ b/UI/DiscordIntegration.cpp @@ -45,6 +45,14 @@ Discord::~Discord() { } } +bool Discord::IsAvailable() { +#ifdef ENABLE_DISCORD + return true; +#else + return false; +#endif +} + bool Discord::IsEnabled() const { return g_Config.bDiscordPresence; } diff --git a/UI/DiscordIntegration.h b/UI/DiscordIntegration.h index df2586eba3..1e3a06946d 100644 --- a/UI/DiscordIntegration.h +++ b/UI/DiscordIntegration.h @@ -19,6 +19,8 @@ public: void SetPresenceMenu(); void ClearPresence(); + static bool IsAvailable(); + private: void Init(); bool IsEnabled() const; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 35213f4986..31527e2beb 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -58,6 +58,7 @@ #include "UI/Theme.h" #include "UI/RetroAchievementScreens.h" #include "UI/OnScreenDisplay.h" +#include "UI/DiscordIntegration.h" #include "Common/File/FileUtil.h" #include "Common/File/AndroidContentURI.h" @@ -915,7 +916,10 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti wlanChannelChoice->HideChoice(i + 2); wlanChannelChoice->HideChoice(i + 7); } - networkingSettings->Add(new CheckBox(&g_Config.bDiscordPresence, n->T("Send Discord Presence information"))); + + if (Discord::IsAvailable()) { + networkingSettings->Add(new CheckBox(&g_Config.bDiscordPresence, n->T("Send Discord Presence information"))); + } networkingSettings->Add(new ItemHeader(n->T("AdHoc Server"))); networkingSettings->Add(new CheckBox(&g_Config.bEnableAdhocServer, n->T("Enable built-in PRO Adhoc Server", "Enable built-in PRO Adhoc Server")));