Sessions are now the unit of the product instead of an implicit capture run. - Nothing is deleted by default: the fixed 10-session cap is gone. An age limit (Never / 7 / 14 / 30 / 90 / 180 / 365 days) is chosen in Settings > Sessions and applied on launch, after archiving, and by "Clean up now". Sent PDFs are never touched. - Each session carries review details: lane, deployed version, commit, reviewer (pre-filled with the Mac user) and a free note. They persist in session.json and are inherited by the next session, so a review run is typed once. - PDF file names are Redline-<yyyyMMdd-HHmm>-<LANE>-<SHORTID>.pdf, and every page carries a two-line reference footer (tool, build time, session / lane, deployed build, commit, reviewer, note). The PDF document info carries the same values in Author and Keywords. - Verification: 159 tests, a headless panel self-test, and a LaunchServices-driven end-to-end run that types and clicks the real panel.
72 lines
2.8 KiB
Swift
72 lines
2.8 KiB
Swift
import Foundation
|
|
|
|
public enum DubaiTime {
|
|
private static let stampFormatter = LockedDateFormatter(dateFormat: "d MMM yyyy, HH:mm 'Dubai'")
|
|
private static let fileStampFormatter = LockedDateFormatter(dateFormat: "yyyyMMdd-HHmmss")
|
|
private static let fileMinuteStampFormatter = LockedDateFormatter(dateFormat: "yyyyMMdd-HHmm")
|
|
private static let checkTimeFormatter = LockedDateFormatter(dateFormat: "HH:mm 'Dubai'")
|
|
private static let shortStampFormatter = LockedDateFormatter(dateFormat: "d MMM yyyy, HH:mm")
|
|
private static let dayStampFormatter = LockedDateFormatter(dateFormat: "d MMM yyyy")
|
|
private static let keywordStampFormatter = LockedDateFormatter(dateFormat: "yyyy-MM-dd HH:mm 'Dubai'")
|
|
|
|
public static func stamp(_ date: Date) -> String {
|
|
stampFormatter.string(from: date)
|
|
}
|
|
|
|
public static func fileStamp(_ date: Date) -> String {
|
|
fileStampFormatter.string(from: date)
|
|
}
|
|
|
|
/// `yyyyMMdd-HHmm` — used in PDF file names where minutes are the useful detail.
|
|
public static func fileMinuteStamp(_ date: Date) -> String {
|
|
fileMinuteStampFormatter.string(from: date)
|
|
}
|
|
|
|
/// "31 Oct 2026, 10:31" — compact session-list timestamp (the timezone is stated
|
|
/// once in the list header, not on every row).
|
|
public static func shortStamp(_ date: Date) -> String {
|
|
shortStampFormatter.string(from: date)
|
|
}
|
|
|
|
/// "31 Oct 2026" — for day-granular expiry notices.
|
|
public static func dayStamp(_ date: Date) -> String {
|
|
dayStampFormatter.string(from: date)
|
|
}
|
|
|
|
/// "2026-10-31 11:00 Dubai" — for PDF keywords, where a comma would be read as a
|
|
/// keyword separator by the PDF format itself.
|
|
public static func keywordStamp(_ date: Date) -> String {
|
|
keywordStampFormatter.string(from: date)
|
|
}
|
|
|
|
public static func checkTime(_ date: Date) -> String {
|
|
checkTimeFormatter.string(from: date)
|
|
}
|
|
}
|
|
|
|
/// DateFormatter is not Sendable. This holder is the only shared mutable state
|
|
/// around a formatter: every read is serialized by the lock, so concurrent
|
|
/// calls (one per PDF page) cannot race.
|
|
private final class LockedDateFormatter: @unchecked Sendable {
|
|
private let lock = NSLock()
|
|
private let formatter: DateFormatter
|
|
|
|
init(dateFormat: String) {
|
|
let formatter = DateFormatter()
|
|
formatter.calendar = Calendar(identifier: .gregorian)
|
|
formatter.locale = Locale(identifier: "en_GB")
|
|
guard let dubai = TimeZone(identifier: "Asia/Dubai") else {
|
|
preconditionFailure("The Asia/Dubai time zone is missing from this system.")
|
|
}
|
|
formatter.timeZone = dubai
|
|
formatter.dateFormat = dateFormat
|
|
self.formatter = formatter
|
|
}
|
|
|
|
func string(from date: Date) -> String {
|
|
lock.lock()
|
|
defer { lock.unlock() }
|
|
return formatter.string(from: date)
|
|
}
|
|
}
|