mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-02-23 13:49:50 +01:00
UI: RPC: Only update presence if a value is actually different from the current presence
This commit is contained in:
parent
7a9b62884a
commit
d7707d4176
@ -117,9 +117,15 @@ namespace Ryujinx.Ava
|
|||||||
_currentApp = appMeta;
|
_currentApp = appMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdatePlayingState()
|
private static bool UpdatePlayingState()
|
||||||
{
|
{
|
||||||
|
if (_discordClient is null) return false;
|
||||||
|
if (_discordClient.CurrentPresence.Details.Equals(_discordPresencePlaying.Details))
|
||||||
|
return false;
|
||||||
|
|
||||||
_discordClient?.SetPresence(_discordPresencePlaying);
|
_discordClient?.SetPresence(_discordPresencePlaying);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SwitchToMainState()
|
private static void SwitchToMainState()
|
||||||
@ -137,19 +143,12 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
PlayReport.Analyzer.FormatPlayReportValue(TitleIDs.CurrentApplication.Value, _currentApp, playReport)
|
PlayReport.Analyzer.FormatPlayReportValue(TitleIDs.CurrentApplication.Value, _currentApp, playReport)
|
||||||
.Match(out bool handled,
|
.Match(out bool handled,
|
||||||
() =>
|
() => _discordPresencePlaying.Details = $"Playing {_currentApp.Title}",
|
||||||
{
|
formattedString => _discordPresencePlaying.Details = formattedString
|
||||||
_discordPresencePlaying.Details = $"Playing {_currentApp.Title}";
|
);
|
||||||
Logger.Info?.Print(LogClass.UI, "Reset Discord RPC based on a supported play report value formatter.");
|
|
||||||
},
|
if (handled && UpdatePlayingState())
|
||||||
formattedString =>
|
Logger.Info?.Print(LogClass.UI, "Updated Discord RPC based on a supported play report.");
|
||||||
{
|
|
||||||
_discordPresencePlaying.Details = formattedString;
|
|
||||||
Logger.Info?.Print(LogClass.UI, "Updated Discord RPC based on a supported play report.");
|
|
||||||
});
|
|
||||||
|
|
||||||
if (handled)
|
|
||||||
UpdatePlayingState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string TruncateToByteLength(string input)
|
private static string TruncateToByteLength(string input)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user