Add neighboring builds handling;

+ provoke angry AppVeyor
This commit is contained in:
HoutarouOreki 2018-07-20 13:51:31 +02:00
parent 1b3010a1b5
commit 227394925a
5 changed files with 67 additions and 12 deletions

View File

@ -7,14 +7,16 @@ namespace osu.Game.Online.API.Requests
{
public class GetChangelogBuildRequest : APIRequest<APIChangelog>
{
private string url;
/// <param name="url">This will need to be changed to "long Id"
/// Placeholder for testing</param>
GetChangelogBuildRequest(string url)
private readonly string name;
private readonly string version;
public GetChangelogBuildRequest(string streamName, string buildVersion)
{
this.url = url;
name = streamName;
version = buildVersion;
}
protected override string Uri => @"";
protected override string Target => url;
//protected override string Target => $@"changelog/{name}/{version}";
protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing
}
}

View File

@ -1,13 +1,20 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogContent : FillFlowContainer<ChangelogContentGroup>
{
private APIChangelog currentBuild;
private APIAccess api;
public ChangelogContent()
{
RelativeSizeAxes = Axes.X;
@ -19,5 +26,52 @@ namespace osu.Game.Overlays.Changelog
Right = 70,
};
}
public override void Add(ChangelogContentGroup changelogContentGroup)
{
changelogContentGroup.PreviousRequested = ShowPrevious;
changelogContentGroup.NextRequested = ShowNext;
base.Add(changelogContentGroup);
}
public void ShowBuild(APIChangelog changelog)
{
Clear();
Add(new ChangelogContentGroup(changelog));
FetchChangelogBuild(changelog);
}
private void ShowNext()
{
if (currentBuild.Versions.Next != null)
{
Clear();
Add(new ChangelogContentGroup(currentBuild.Versions.Next));
FetchChangelogBuild(currentBuild.Versions.Next);
}
}
private void ShowPrevious()
{
if (currentBuild.Versions.Previous != null)
{
Clear();
Add(new ChangelogContentGroup(currentBuild.Versions.Previous));
FetchChangelogBuild(currentBuild.Versions.Previous);
}
}
[BackgroundDependencyLoader]
private void load(APIAccess api)
{
this.api = api;
}
private void FetchChangelogBuild(APIChangelog build)
{
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
req.Success += res => currentBuild = res;
api.Queue(req);
}
}
}

View File

@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_left,
Size = new Vector2(24),
TooltipText = "Previous",
OnPressed = PreviousRequested,
OnPressed = () => PreviousRequested(),
},
new FillFlowContainer<SpriteText>
{
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_right,
Size = new Vector2(24),
TooltipText = "Next",
OnPressed = NextRequested,
OnPressed = () => NextRequested(),
},
}
},

View File

@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Changelog
new SpriteText
{
Text = ChangelogEntry.Users > 0 ?
string.Format($"{ChangelogEntry.Users:N0} users online") :
$"{ChangelogEntry.Users:N0} users online" :
null,
TextSize = 12,
Font = @"Exo2.0-Regular",

View File

@ -87,8 +87,7 @@ namespace osu.Game.Overlays
header.ChangelogEntry = Streams.SelectedRelease;
}
header.ShowReleaseStream();
content.Clear(); // this should probably happen with some transition
content.Add(new ChangelogContentGroup(Streams.SelectedRelease));
content.ShowBuild(Streams.SelectedRelease);
};
header.OnListingActivated += () =>
{