macos: populate the sparkle:channel element (#9906)
This makes the update channel name available alongside the version, data, etc., which we can use in our update view (on the Released line). <img width="317" height="230" alt="CleanShot 2025-12-14 at 09 48 43@2x" src="https://github.com/user-attachments/assets/b9695090-a219-44b7-b74e-0ba599ae5f52" />pull/8075/head
commit
44b82e1eb1
|
|
@ -77,6 +77,8 @@ elem = ET.SubElement(item, "title")
|
|||
elem.text = f"Build {build}"
|
||||
elem = ET.SubElement(item, "pubDate")
|
||||
elem.text = now.strftime(pubdate_format)
|
||||
elem = ET.SubElement(item, "sparkle:channel")
|
||||
elem.text = "stable"
|
||||
elem = ET.SubElement(item, "sparkle:version")
|
||||
elem.text = build
|
||||
elem = ET.SubElement(item, "sparkle:shortVersionString")
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ elem = ET.SubElement(item, "title")
|
|||
elem.text = f"Build {build}"
|
||||
elem = ET.SubElement(item, "pubDate")
|
||||
elem.text = now.strftime(pubdate_format)
|
||||
elem = ET.SubElement(item, "sparkle:channel")
|
||||
elem.text = "tip"
|
||||
elem = ET.SubElement(item, "sparkle:version")
|
||||
elem.text = build
|
||||
elem = ET.SubElement(item, "sparkle:shortVersionString")
|
||||
|
|
|
|||
|
|
@ -126,6 +126,14 @@ fileprivate struct UpdateAvailableView: View {
|
|||
|
||||
private let labelWidth: CGFloat = 60
|
||||
|
||||
private func releaseDateString(date: Date, channel: String?) -> String {
|
||||
let dateString = date.formatted(date: .abbreviated, time: .omitted)
|
||||
if let channel, !channel.isEmpty {
|
||||
return "\(dateString) (\(channel))"
|
||||
}
|
||||
return dateString
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
|
|
@ -157,7 +165,7 @@ fileprivate struct UpdateAvailableView: View {
|
|||
Text("Released:")
|
||||
.foregroundColor(.secondary)
|
||||
.frame(width: labelWidth, alignment: .trailing)
|
||||
Text(date.formatted(date: .abbreviated, time: .omitted))
|
||||
Text(releaseDateString(date: date, channel: update.appcastItem.channel))
|
||||
}
|
||||
.font(.system(size: 11))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue