Rename APIChangelog to APIChangelogBuild

This commit is contained in:
Hōtarō Oreki
2018-10-18 21:04:21 +02:00
parent 510b52a503
commit b8ac328ae9
10 changed files with 26 additions and 26 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual
AddWaitStep(3); AddWaitStep(3);
AddStep(@"Show with Lazer 2018.712.0", () => AddStep(@"Show with Lazer 2018.712.0", () =>
{ {
changelog.FetchAndShowBuild(new APIChangelog changelog.FetchAndShowBuild(new APIChangelogBuild
{ {
Version = "2018.712.0", Version = "2018.712.0",
UpdateStream = new UpdateStream { Name = "lazer" }, UpdateStream = new UpdateStream { Name = "lazer" },

View File

@ -5,7 +5,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetChangelogBuildRequest : APIRequest<APIChangelog> public class GetChangelogBuildRequest : APIRequest<APIChangelogBuild>
{ {
private readonly string name; private readonly string name;
private readonly string version; private readonly string version;

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetChangelogLatestBuildsRequest : APIRequest<List<APIChangelog>> public class GetChangelogLatestBuildsRequest : APIRequest<List<APIChangelogBuild>>
{ {
protected override string Target => @"changelog/latest-builds"; protected override string Target => @"changelog/latest-builds";
protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing

View File

@ -5,7 +5,7 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class GetChangelogRequest : APIRequest<APIChangelog[]> public class GetChangelogRequest : APIRequest<APIChangelogBuild[]>
{ {
protected override string Target => @"changelog"; protected override string Target => @"changelog";
protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}/index"; // for testing protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}/index"; // for testing

View File

@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace osu.Game.Online.API.Requests.Responses namespace osu.Game.Online.API.Requests.Responses
{ {
public class APIChangelog public class APIChangelogBuild
{ {
[JsonProperty("id")] [JsonProperty("id")]
public long Id { get; set; } public long Id { get; set; }
@ -40,10 +40,10 @@ namespace osu.Game.Online.API.Requests.Responses
public class Versions public class Versions
{ {
[JsonProperty("next")] [JsonProperty("next")]
public APIChangelog Next { get; set; } public APIChangelogBuild Next { get; set; }
[JsonProperty("previous")] [JsonProperty("previous")]
public APIChangelog Previous { get; set; } public APIChangelogBuild Previous { get; set; }
} }
public class ChangelogEntry public class ChangelogEntry

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Changelog
private const float vertical_padding = 20; private const float vertical_padding = 20;
private const float horizontal_padding = 85; private const float horizontal_padding = 85;
public delegate void SelectionHandler(APIChangelog releaseStream, EventArgs args); public delegate void SelectionHandler(APIChangelogBuild releaseStream, EventArgs args);
public event SelectionHandler Selected; public event SelectionHandler Selected;
@ -46,9 +46,9 @@ namespace osu.Game.Overlays.Changelog
}; };
} }
public void Populate(List<APIChangelog> latestBuilds) public void Populate(List<APIChangelogBuild> latestBuilds)
{ {
foreach (APIChangelog updateStream in latestBuilds) foreach (APIChangelogBuild updateStream in latestBuilds)
{ {
var streamBadge = new StreamBadge(updateStream); var streamBadge = new StreamBadge(updateStream);
streamBadge.Selected += onBadgeSelected; streamBadge.Selected += onBadgeSelected;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Changelog
private APIAccess api; private APIAccess api;
private ChangelogContentGroup changelogContentGroup; private ChangelogContentGroup changelogContentGroup;
public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args);
public event BuildSelectedEventHandler BuildSelected; public event BuildSelectedEventHandler BuildSelected;
@ -28,12 +28,12 @@ namespace osu.Game.Overlays.Changelog
Padding = new MarginPadding{ Bottom = 100 }; Padding = new MarginPadding{ Bottom = 100 };
} }
public void ShowListing(APIChangelog[] changelog) public void ShowListing(APIChangelogBuild[] changelog)
{ {
DateTime currentDate = new DateTime(); DateTime currentDate = new DateTime();
Clear(); Clear();
foreach (APIChangelog build in changelog) foreach (APIChangelogBuild build in changelog)
{ {
if (build.CreatedAt.Date != currentDate) if (build.CreatedAt.Date != currentDate)
{ {
@ -71,7 +71,7 @@ namespace osu.Game.Overlays.Changelog
} }
} }
public void ShowBuild(APIChangelog changelogBuild) public void ShowBuild(APIChangelogBuild changelogBuild)
{ {
Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild); Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild);
changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries); changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries);
@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Changelog
changelogContentGroup.BuildSelected += OnBuildSelected; changelogContentGroup.BuildSelected += OnBuildSelected;
} }
protected virtual void OnBuildSelected(APIChangelog build, EventArgs args) protected virtual void OnBuildSelected(APIChangelogBuild build, EventArgs args)
{ {
BuildSelected?.Invoke(build, EventArgs.Empty); BuildSelected?.Invoke(build, EventArgs.Empty);
} }

View File

@ -21,13 +21,13 @@ namespace osu.Game.Overlays.Changelog
private readonly SortedDictionary<string, List<ChangelogEntry>> categories = private readonly SortedDictionary<string, List<ChangelogEntry>> categories =
new SortedDictionary<string, List<ChangelogEntry>>(); new SortedDictionary<string, List<ChangelogEntry>>();
public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args); public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args);
public event BuildSelectedEventHandler BuildSelected; public event BuildSelectedEventHandler BuildSelected;
public readonly FillFlowContainer ChangelogEntries; public readonly FillFlowContainer ChangelogEntries;
public ChangelogContentGroup(APIChangelog build) public ChangelogContentGroup(APIChangelogBuild build)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Changelog
}; };
} }
public ChangelogContentGroup(APIChangelog build, bool newDate) public ChangelogContentGroup(APIChangelogBuild build, bool newDate)
{ {
OsuHoverContainer clickableBuildText; OsuHoverContainer clickableBuildText;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -202,7 +202,7 @@ namespace osu.Game.Overlays.Changelog
} }
} }
protected virtual void OnBuildSelected(APIChangelog build) protected virtual void OnBuildSelected(APIChangelogBuild build)
{ {
BuildSelected?.Invoke(build, EventArgs.Empty); BuildSelected?.Invoke(build, EventArgs.Empty);
} }

View File

@ -33,10 +33,10 @@ namespace osu.Game.Overlays.Changelog
private SampleChannel sampleClick; private SampleChannel sampleClick;
private SampleChannel sampleHover; private SampleChannel sampleHover;
public readonly APIChangelog LatestBuild; public readonly APIChangelogBuild LatestBuild;
private readonly FillFlowContainer<SpriteText> text; private readonly FillFlowContainer<SpriteText> text;
public StreamBadge(APIChangelog latestBuild) public StreamBadge(APIChangelogBuild latestBuild)
{ {
LatestBuild = latestBuild; LatestBuild = latestBuild;
Height = badge_height; Height = badge_height;

View File

@ -152,7 +152,7 @@ namespace osu.Game.Overlays
return false; return false;
} }
private void onBuildSelected(APIChangelog build, EventArgs e) => FetchAndShowBuild(build); private void onBuildSelected(APIChangelogBuild build, EventArgs e) => FetchAndShowBuild(build);
private void fetchListing() private void fetchListing()
{ {
@ -183,12 +183,12 @@ namespace osu.Game.Overlays
/// <summary> /// <summary>
/// Fetches and shows a specific build from a specific update stream. /// Fetches and shows a specific build from a specific update stream.
/// </summary> /// </summary>
/// <param name="build">Must contain at least <see cref="APIChangelog.UpdateStream.Name"/> and /// <param name="build">Must contain at least <see cref="APIChangelogBuild.UpdateStream.Name"/> and
/// <see cref="APIChangelog.Version"/>. If <see cref="APIChangelog.UpdateStream.DisplayName"/> and /// <see cref="APIChangelogBuild.Version"/>. If <see cref="APIChangelogBuild.UpdateStream.DisplayName"/> and
/// <see cref="APIChangelog.DisplayVersion"/> are specified, the header will instantly display them.</param> /// <see cref="APIChangelogBuild.DisplayVersion"/> are specified, the header will instantly display them.</param>
/// <param name="updateBadges">Whether to update badges. Should be set to false in case /// <param name="updateBadges">Whether to update badges. Should be set to false in case
/// the function is called by selecting a badge, to avoid an infinite loop.</param> /// the function is called by selecting a badge, to avoid an infinite loop.</param>
public void FetchAndShowBuild(APIChangelog build, bool updateBadges = true) public void FetchAndShowBuild(APIChangelogBuild build, bool updateBadges = true)
{ {
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);