From b049ffa11d0c1b879ab36d18b1cb31de72cdb447 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 20 Jul 2018 18:23:25 +0200 Subject: [PATCH] Improve fake-api --- .../API/Requests/GetChangelogBuildRequest.cs | 18 +++++++++--------- .../GetChangelogLatestBuildsRequest.cs | 4 ++-- .../Online/API/Requests/GetChangelogRequest.cs | 4 ++-- .../Overlays/Changelog/ChangelogContent.cs | 9 +++------ .../Changelog/ChangelogContentGroup.cs | 14 ++------------ 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs index 5d4d3b860c..2338b90865 100644 --- a/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogBuildRequest.cs @@ -7,16 +7,16 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogBuildRequest : APIRequest { - //private readonly string name; - //private readonly string version; + private readonly string name; + private readonly string version; - //public GetChangelogBuildRequest(string streamName, string buildVersion) - //{ - // name = streamName; - // version = buildVersion; - //} + public GetChangelogBuildRequest(string streamName, string buildVersion) + { + name = streamName; + version = buildVersion; + } - //protected override string Target => $@"changelog/{name}/{version}"; - protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing + protected override string Target => $@"changelog/{name}/{version}"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs index 962c8eab15..7940fd8ff5 100644 --- a/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogLatestBuildsRequest.cs @@ -8,7 +8,7 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogLatestBuildsRequest : APIRequest> { - //protected override string Target => @"changelog"; - protected override string Uri => @"https://api.myjson.com/bins/16waui"; // for testing + protected override string Target => @"changelog/latest-builds"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Online/API/Requests/GetChangelogRequest.cs b/osu.Game/Online/API/Requests/GetChangelogRequest.cs index 6ddff7052e..2f2e0ffe67 100644 --- a/osu.Game/Online/API/Requests/GetChangelogRequest.cs +++ b/osu.Game/Online/API/Requests/GetChangelogRequest.cs @@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests { public class GetChangelogRequest : APIRequest { - //protected override string Target => @"changelog"; - protected override string Uri => @"https://api.myjson.com/bins/6zv2i"; // for testing + protected override string Target => @"changelog"; + protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing } } diff --git a/osu.Game/Overlays/Changelog/ChangelogContent.cs b/osu.Game/Overlays/Changelog/ChangelogContent.cs index 16e9d1a074..1f89fba9e1 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContent.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContent.cs @@ -41,8 +41,7 @@ namespace osu.Game.Overlays.Changelog { Clear(); add(changelog); - //fetchChangelogBuild(changelog); - fetchChangelogBuild(); + fetchChangelogBuild(changelog); } private void showNext() @@ -69,11 +68,9 @@ namespace osu.Game.Overlays.Changelog this.api = api; } - //private void fetchChangelogBuild(APIChangelog build) - private void fetchChangelogBuild() + private void fetchChangelogBuild(APIChangelog build) { - //var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); - var req = new GetChangelogBuildRequest(); + var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); req.Success += res => { currentBuild = res; diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 5b22b360e5..3b67aa36ec 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -108,20 +108,10 @@ namespace osu.Game.Overlays.Changelog public void UpdateChevronTooltips(string previousVersion, string nextVersion) { - if (string.IsNullOrEmpty(previousVersion)) - chevronPrevious.IsEnabled = false; - else - { + if (!string.IsNullOrEmpty(previousVersion)) chevronPrevious.TooltipText = previousVersion; - chevronPrevious.IsEnabled = true; - } - if (string.IsNullOrEmpty(nextVersion)) - chevronNext.IsEnabled = false; - else - { + if (!string.IsNullOrEmpty(nextVersion)) chevronNext.TooltipText = nextVersion; - chevronNext.IsEnabled = true; - } } //public ChangelogContentGroup() { } // for listing }