1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +08:00

API request clean-up

This commit is contained in:
Dean Herbert 2019-05-15 18:21:06 +09:00
parent 827ca445b1
commit 1505ca976b
2 changed files with 18 additions and 14 deletions

View File

@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses
public List<APIChangelogEntry> ChangelogEntries { get; set; }
[JsonProperty("versions")]
public VersionNativation Versions { get; set; }
public VersionNatigation Versions { get; set; }
public class VersionNativation
public class VersionNatigation
{
[JsonProperty("next")]
public APIChangelogBuild Next { get; set; }

View File

@ -157,28 +157,32 @@ namespace osu.Game.Overlays
/// <see cref="APIChangelogBuild.DisplayVersion"/> are specified, the header will instantly display them.</param>
public void ShowBuild(APIChangelogBuild build)
{
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null)
header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion);
else
req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion);
header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion);
badges.SelectUpdateStream(build.UpdateStream.Name);
req.Success += apiChangelog =>
listing.Hide();
void displayBuild(APIChangelogBuild populatedBuild)
{
listing.Hide();
content.Show();
content.ShowBuild(apiChangelog);
content.ShowBuild(populatedBuild);
if (scroll.Current > scroll.GetChildPosInContent(content))
scroll.ScrollTo(content);
if (isAtListing)
savedScrollPosition = scroll.Current;
isAtListing = false;
};
}
API.Queue(req);
if (build.Versions != null)
displayBuild(build);
else
{
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
req.Success += displayBuild;
API.Queue(req);
}
}
}
}