mirror of
https://github.com/ppy/osu
synced 2024-12-14 10:57:41 +00:00
Nullables in APIChangelog; Primitive changelog entries display
This commit is contained in:
parent
c36a303b36
commit
8d4de68c39
@ -25,7 +25,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public bool IsFeatured { get; set; }
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("update_stream")]
|
||||
public UpdateStream UpdateStream { get; set; }
|
||||
@ -49,19 +49,19 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public class ChangelogEntry
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonProperty("repository")]
|
||||
public string Repository { get; set; }
|
||||
|
||||
[JsonProperty("github_pull_request_id")]
|
||||
public long GithubPullRequestId { get; set; }
|
||||
public long? GithubPullRequestId { get; set; }
|
||||
|
||||
[JsonProperty("github_url")]
|
||||
public string GithubUrl { get; set; }
|
||||
|
||||
[JsonProperty("url")]
|
||||
public object Url { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
@ -76,10 +76,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public string MessageHtml { get; set; }
|
||||
|
||||
[JsonProperty("major")]
|
||||
public bool Major { get; set; }
|
||||
public bool? Major { get; set; }
|
||||
|
||||
[JsonProperty("created_at")]
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("github_user")]
|
||||
public GithubUser GithubUser { get; set; }
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public class GithubUser
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public long Id { get; set; }
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonProperty("display_name")]
|
||||
public string DisplayName { get; set; }
|
||||
|
@ -83,6 +83,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
req.Success += res =>
|
||||
{
|
||||
CurrentBuild = res;
|
||||
changelogContentGroup.GenerateText(CurrentBuild.ChangelogEntries);
|
||||
updateChevronTooltips();
|
||||
};
|
||||
api.Queue(req);
|
||||
|
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
@ -17,6 +18,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
private readonly TooltipIconButton chevronPrevious, chevronNext;
|
||||
|
||||
public Action NextRequested, PreviousRequested;
|
||||
public readonly TextFlowContainer ChangelogEntries;
|
||||
|
||||
public ChangelogContentGroup(APIChangelog build)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -92,7 +95,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
// do we need .ToUniversalTime() here?
|
||||
// also, this should be a temporary solution to weekdays in >localized< date strings
|
||||
Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""),
|
||||
Text = build.CreatedAt.HasValue ? build.CreatedAt.Value.Date.ToLongDateString()
|
||||
.Replace(build.CreatedAt.Value.ToString("dddd") + ", ", "") : null,
|
||||
TextSize = 17, // web: 14,
|
||||
Colour = OsuColour.FromHex(@"FD5"),
|
||||
Font = @"Exo2.0-Medium",
|
||||
@ -103,6 +107,11 @@ namespace osu.Game.Overlays.Changelog
|
||||
Top = 5,
|
||||
},
|
||||
},
|
||||
ChangelogEntries = new TextFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -119,6 +128,17 @@ namespace osu.Game.Overlays.Changelog
|
||||
chevronNext.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateText(List<ChangelogEntry> changelogEntries)
|
||||
{
|
||||
foreach (ChangelogEntry entry in changelogEntries)
|
||||
{
|
||||
ChangelogEntries.AddParagraph(entry.Type);
|
||||
ChangelogEntries.AddParagraph(entry.Title);
|
||||
ChangelogEntries.AddText($"({entry.Repository}#{entry.GithubPullRequestId})");
|
||||
ChangelogEntries.AddText($"by {entry.GithubUser.DisplayName}");
|
||||
}
|
||||
}
|
||||
//public ChangelogContentGroup() { } // for listing
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user