Show milestone and pull request states

This commit is contained in:
Georg Bauer
2026-07-31 18:39:10 +02:00
parent acf2c839ad
commit 128be97e20
6 changed files with 148 additions and 33 deletions

View File

@@ -227,7 +227,8 @@ final class IssueViewController: MarkdownPageViewController {
if let page {
replaceContent(detailViews(
title: page.title,
issueState: page.state,
state: page.state,
stateSubject: "issue",
meta: page.meta,
body: page.body,
comments: page.comments,
@@ -305,6 +306,8 @@ final class PullViewController: MarkdownPageViewController {
if let page {
var views = detailViews(
title: page.title,
state: page.state,
stateSubject: "pull request",
meta: page.meta,
body: page.body,
comments: []
@@ -1138,7 +1141,8 @@ final class DiffViewController: UIViewController {
private func detailViews(
title: String,
issueState: String? = nil,
state: String? = nil,
stateSubject: String = "",
meta: String,
body: String,
comments: [CommentRow],
@@ -1156,7 +1160,10 @@ private func detailViews(
metaLabel.textColor = .secondaryLabel
metaLabel.numberOfLines = 0
let bodyView = markdownView(body)
var views: [UIView] = [issueState.map { issueTitle(titleLabel, state: $0) } ?? titleLabel, metaLabel]
var views: [UIView] = [
state.map { stateTitle(titleLabel, state: $0, subject: stateSubject) } ?? titleLabel,
metaLabel,
]
if !milestone.isEmpty {
let milestoneLabel = UILabel()
milestoneLabel.attributedText = symbolText(
@@ -1172,9 +1179,9 @@ private func detailViews(
return views + [separator(), bodyView] + commentViews(comments, editComment: editComment)
}
private func issueTitle(_ titleLabel: UILabel, state: String) -> UIView {
private func stateTitle(_ titleLabel: UILabel, state: String, subject: String) -> UIView {
let icon = UIImageView()
configureIssueStateIcon(icon, state: state, textStyle: .title1)
configureOpenClosedStateIcon(icon, state: state, subject: subject, textStyle: .title1)
let stack = UIStackView(arrangedSubviews: [icon, titleLabel])
stack.axis = .horizontal
stack.alignment = .firstBaseline