diff --git a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs index 063555cf76..851cf17cfc 100644 --- a/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseChangelogOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual changelog.FetchAndShowBuild(new APIChangelogBuild { Version = "2018.712.0", - UpdateStream = new UpdateStream { Name = "lazer" }, + UpdateStream = new APIUpdateStream { Name = "lazer" }, }); changelog.Show(); }); diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs index 64b62e1f73..03c3ed0957 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogBuild.cs @@ -25,99 +25,21 @@ namespace osu.Game.Online.API.Requests.Responses public DateTimeOffset CreatedAt { get; set; } [JsonProperty("update_stream")] - public UpdateStream UpdateStream { get; set; } + public APIUpdateStream UpdateStream { get; set; } [JsonProperty("changelog_entries")] - public List ChangelogEntries { get; set; } + public List ChangelogEntries { get; set; } [JsonProperty("versions")] - public Versions Versions { get; set; } - } + public VersionNativation Versions { get; set; } - public class Versions - { - [JsonProperty("next")] - public APIChangelogBuild Next { get; set; } + public class VersionNativation + { + [JsonProperty("next")] + public APIChangelogBuild Next { get; set; } - [JsonProperty("previous")] - public APIChangelogBuild Previous { get; set; } - } - - public class ChangelogEntry - { - [JsonProperty("id")] - public long? Id { get; set; } - - [JsonProperty("repository")] - public string Repository { get; set; } - - [JsonProperty("github_pull_request_id")] - public long? GithubPullRequestId { get; set; } - - [JsonProperty("github_url")] - public string GithubUrl { get; set; } - - [JsonProperty("url")] - public string Url { get; set; } - - [JsonProperty("type")] - public string Type { get; set; } - - [JsonProperty("category")] - public string Category { get; set; } - - [JsonProperty("title")] - public string Title { get; set; } - - [JsonProperty("message_html")] - public string MessageHtml { get; set; } - - [JsonProperty("major")] - public bool? Major { get; set; } - - [JsonProperty("created_at")] - public DateTimeOffset? CreatedAt { get; set; } - - [JsonProperty("github_user")] - public GithubUser GithubUser { get; set; } - } - - public class GithubUser - { - [JsonProperty("id")] - public long? Id { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("github_url")] - public string GithubUrl { get; set; } - - [JsonProperty("osu_username")] - public string OsuUsername { get; set; } - - [JsonProperty("user_id")] - public long? UserId { get; set; } - - [JsonProperty("user_url")] - public string UserUrl { get; set; } - } - - public class UpdateStream - { - [JsonProperty("id")] - public long Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("is_featured")] - public bool IsFeatured { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("latest_build")] - public APIChangelogBuild LatestBuild { get; set; } + [JsonProperty("previous")] + public APIChangelogBuild Previous { get; set; } + } } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs new file mode 100644 index 0000000000..abaff9b7ae --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogEntry.cs @@ -0,0 +1,47 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogEntry + { + [JsonProperty("id")] + public long? Id { get; set; } + + [JsonProperty("repository")] + public string Repository { get; set; } + + [JsonProperty("github_pull_request_id")] + public long? GithubPullRequestId { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("url")] + public string Url { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("category")] + public string Category { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("message_html")] + public string MessageHtml { get; set; } + + [JsonProperty("major")] + public bool? Major { get; set; } + + [JsonProperty("created_at")] + public DateTimeOffset? CreatedAt { get; set; } + + [JsonProperty("github_user")] + public APIChangelogUser GithubUser { get; set; } + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs index 957694b887..2c31ba6659 100644 --- a/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogIndex.cs @@ -9,6 +9,6 @@ namespace osu.Game.Online.API.Requests.Responses { public List Builds; - public List Streams; + public List Streams; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs new file mode 100644 index 0000000000..5891391e83 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIChangelogUser.cs @@ -0,0 +1,28 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIChangelogUser + { + [JsonProperty("id")] + public long? Id { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("github_url")] + public string GithubUrl { get; set; } + + [JsonProperty("osu_username")] + public string OsuUsername { get; set; } + + [JsonProperty("user_id")] + public long? UserId { get; set; } + + [JsonProperty("user_url")] + public string UserUrl { get; set; } + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs new file mode 100644 index 0000000000..5cf56333bb --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIUpdateStream.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIUpdateStream + { + [JsonProperty("id")] + public long Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("is_featured")] + public bool IsFeatured { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("latest_build")] + public APIChangelogBuild LatestBuild { get; set; } + } +} diff --git a/osu.Game/Overlays/Changelog/ChangelogBadges.cs b/osu.Game/Overlays/Changelog/ChangelogBadges.cs index 372ef76351..e95fa72f2e 100644 --- a/osu.Game/Overlays/Changelog/ChangelogBadges.cs +++ b/osu.Game/Overlays/Changelog/ChangelogBadges.cs @@ -45,9 +45,9 @@ namespace osu.Game.Overlays.Changelog }; } - public void Populate(List streams) + public void Populate(List streams) { - foreach (UpdateStream updateStream in streams) + foreach (APIUpdateStream updateStream in streams) { var streamBadge = new StreamBadge(updateStream); streamBadge.Selected += onBadgeSelected; diff --git a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs index 0e846ae115..e9ca025425 100644 --- a/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs +++ b/osu.Game/Overlays/Changelog/ChangelogContentGroup.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Changelog { private readonly TooltipIconButton chevronPrevious, chevronNext; - private readonly SortedDictionary> categories = - new SortedDictionary>(); + private readonly SortedDictionary> categories = + new SortedDictionary>(); public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args); @@ -204,18 +204,18 @@ namespace osu.Game.Overlays.Changelog BuildSelected?.Invoke(build, EventArgs.Empty); } - public void GenerateText(List changelogEntries) + public void GenerateText(List changelogEntries) { // sort entries by category - foreach (ChangelogEntry entry in changelogEntries) + foreach (APIChangelogEntry entry in changelogEntries) { if (!categories.ContainsKey(entry.Category)) - categories.Add(entry.Category, new List { entry }); + categories.Add(entry.Category, new List { entry }); else categories[entry.Category].Add(entry); } - foreach (KeyValuePair> category in categories) + foreach (KeyValuePair> category in categories) { ChangelogEntries.Add(new SpriteText { @@ -224,7 +224,7 @@ namespace osu.Game.Overlays.Changelog Margin = new MarginPadding { Top = 35, Bottom = 15 }, }); - foreach (ChangelogEntry entry in category.Value) + foreach (APIChangelogEntry entry in category.Value) { LinkFlowContainer title = new LinkFlowContainer { diff --git a/osu.Game/Overlays/Changelog/StreamBadge.cs b/osu.Game/Overlays/Changelog/StreamBadge.cs index 6c3c95a2b3..b617ae8f53 100644 --- a/osu.Game/Overlays/Changelog/StreamBadge.cs +++ b/osu.Game/Overlays/Changelog/StreamBadge.cs @@ -32,11 +32,11 @@ namespace osu.Game.Overlays.Changelog private SampleChannel sampleClick; private SampleChannel sampleHover; - public readonly UpdateStream Stream; + public readonly APIUpdateStream Stream; private readonly FillFlowContainer text; - public StreamBadge(UpdateStream stream) + public StreamBadge(APIUpdateStream stream) { Stream = stream; diff --git a/osu.Game/Overlays/ChangelogOverlay.cs b/osu.Game/Overlays/ChangelogOverlay.cs index 276ec622c7..e9fd5789ed 100644 --- a/osu.Game/Overlays/ChangelogOverlay.cs +++ b/osu.Game/Overlays/ChangelogOverlay.cs @@ -189,8 +189,8 @@ namespace osu.Game.Overlays /// /// Fetches and shows a specific build from a specific update stream. /// - /// Must contain at least and - /// . If and + /// Must contain at least and + /// . If and /// are specified, the header will instantly display them. /// Whether to update badges. Should be set to false in case /// the function is called by selecting a badge, to avoid an infinite loop.