Avoid sending HTTP requests to the FetchNews URL when FetchNews is disabled

Also disables the 'Send SysInfo' settings checkbox when 'Fetch News' is disabled as well.
This commit is contained in:
Oliver Brakmann
2018-07-04 22:19:14 +02:00
committed by reaperrr
parent d21b959bf0
commit 3e29ef0bd6
2 changed files with 4 additions and 1 deletions

View File

@@ -287,7 +287,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
void LoadAndDisplayNews(string newsURL, Widget newsBG) void LoadAndDisplayNews(string newsURL, Widget newsBG)
{ {
if (newsBG != null) if (newsBG != null && Game.Settings.Game.FetchNews)
{ {
var cacheFile = Platform.ResolvePath(Platform.SupportDirPrefix, "news.yaml"); var cacheFile = Platform.ResolvePath(Platform.SupportDirPrefix, "news.yaml");
var currentNews = ParseNews(cacheFile); var currentNews = ParseNews(cacheFile);

View File

@@ -492,6 +492,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
BindCheckboxPref(panel, "CHECK_VERSION_CHECKBOX", ds, "CheckVersion"); BindCheckboxPref(panel, "CHECK_VERSION_CHECKBOX", ds, "CheckVersion");
BindCheckboxPref(panel, "REPLAY_COMMANDS_CHECKBOX", ds, "EnableDebugCommandsInReplays"); BindCheckboxPref(panel, "REPLAY_COMMANDS_CHECKBOX", ds, "EnableDebugCommandsInReplays");
var ssi = panel.Get<CheckboxWidget>("SENDSYSINFO_CHECKBOX");
ssi.IsDisabled = () => !gs.FetchNews;
return () => { }; return () => { };
} }