Outpost's version was missing the -ALPHA suffix About already shows — extracted OutpostVersion (Support/) as the one shared source for both, so a third divergent copy can't happen the way AboutInfoView's own doc comment already warns against for its two call sites. Outline's version now accounts for the manual Offline Mode toggle too, not just real connectivity, shows "Outline — offline" instead of just disappearing when nothing's been fetched yet, and re-fetches automatically via .task(id: isEffectivelyOnline) whenever connectivity changes — previously a one-shot fetch on first sidebar mount only.
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
import Foundation
|
|
|
|
/// Single source of truth for how Outpost's own version is formatted —
|
|
/// used by both the About page and the Settings sidebar footer, so they
|
|
/// can't drift out of sync the way `AboutInfoView` was already written to
|
|
/// avoid for its own two call sites.
|
|
enum OutpostVersion {
|
|
/// Bumped alongside `MARKETING_VERSION` in the Xcode project — kept out
|
|
/// of the bundle version itself since `CFBundleShortVersionString` is
|
|
/// expected to stay a plain dotted-numeric string, not `0.0.1-ALPHA`.
|
|
static let releaseStage = "ALPHA"
|
|
|
|
static var shortVersion: String {
|
|
Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "0.0.1"
|
|
}
|
|
|
|
static var buildNumber: String {
|
|
Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "1"
|
|
}
|
|
|
|
/// e.g. `"0.0.3-ALPHA"` — for compact display (sidebar footer).
|
|
static var displayString: String {
|
|
let stageSuffix = releaseStage.isEmpty ? "" : "-\(releaseStage)"
|
|
return "\(shortVersion)\(stageSuffix)"
|
|
}
|
|
|
|
/// e.g. `"Version 0.0.3-ALPHA (1)"` — for the About page.
|
|
static var fullVersionString: String {
|
|
"Version \(displayString) (\(buildNumber))"
|
|
}
|
|
}
|