Hide the Discord Rich Presence option on platforms where we don't support it

This commit is contained in:
Henrik Rydgård 2024-11-02 21:31:45 +01:00
parent 6b753c1d63
commit 55d110493a
3 changed files with 15 additions and 1 deletions

View File

@ -45,6 +45,14 @@ Discord::~Discord() {
} }
} }
bool Discord::IsAvailable() {
#ifdef ENABLE_DISCORD
return true;
#else
return false;
#endif
}
bool Discord::IsEnabled() const { bool Discord::IsEnabled() const {
return g_Config.bDiscordPresence; return g_Config.bDiscordPresence;
} }

View File

@ -19,6 +19,8 @@ public:
void SetPresenceMenu(); void SetPresenceMenu();
void ClearPresence(); void ClearPresence();
static bool IsAvailable();
private: private:
void Init(); void Init();
bool IsEnabled() const; bool IsEnabled() const;

View File

@ -58,6 +58,7 @@
#include "UI/Theme.h" #include "UI/Theme.h"
#include "UI/RetroAchievementScreens.h" #include "UI/RetroAchievementScreens.h"
#include "UI/OnScreenDisplay.h" #include "UI/OnScreenDisplay.h"
#include "UI/DiscordIntegration.h"
#include "Common/File/FileUtil.h" #include "Common/File/FileUtil.h"
#include "Common/File/AndroidContentURI.h" #include "Common/File/AndroidContentURI.h"
@ -915,7 +916,10 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
wlanChannelChoice->HideChoice(i + 2); wlanChannelChoice->HideChoice(i + 2);
wlanChannelChoice->HideChoice(i + 7); 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 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"))); networkingSettings->Add(new CheckBox(&g_Config.bEnableAdhocServer, n->T("Enable built-in PRO Adhoc Server", "Enable built-in PRO Adhoc Server")));