Skip to content

Commit 5e0c33d

Browse files
Improve About dialog version detection for different build types
🔧 Version Detection Improvements: - Enhanced buildNumber detection to distinguish between local and GitHub Actions builds - Local builds: CFBundleVersion is 7-char git hash (alphanumeric) - GitHub Actions builds: CFBundleVersion is build number (numeric) - Added logic to detect build type based on CFBundleVersion format 📱 About Dialog Enhancements: - Version display now consistent across build types - Build number shows appropriate value for each build type - Git hash always shows first 7 characters for readability - Better handling of different Info.plist formats This ensures About dialog shows correct information for both local development builds and GitHub Actions releases.
1 parent c6ccbb5 commit 5e0c33d

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

A6Cutter/AboutView.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,21 @@ struct AboutView: View {
7979

8080
private var buildNumber: String {
8181
if let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
82-
// For local builds, CFBundleVersion is git commit hash
83-
// For GitHub Actions builds, it might be a number
84-
return build
82+
// For local builds, CFBundleVersion is git commit hash (7 chars)
83+
// For GitHub Actions builds, it's a build number
84+
// Check if it looks like a git hash (7 chars, alphanumeric)
85+
if build.count == 7 && build.allSatisfy({ $0.isLetter || $0.isNumber }) {
86+
return build // Local build - git hash
87+
} else {
88+
return build // GitHub Actions build - build number
89+
}
8590
}
8691
return "dev"
8792
}
8893

8994
private var gitHash: String {
90-
// V produkční verzi by toto bylo nastaveno během buildu
91-
// Pro dev verzi vrátíme "dev"
9295
if let hash = Bundle.main.infoDictionary?["GitHash"] as? String {
96+
// Show first 7 characters of git hash for readability
9397
return String(hash.prefix(7))
9498
}
9599
return "dev"

A6Cutter/Info.plist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<key>CFBundlePackageType</key>
1414
<string>APPL</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>v1.0.28</string>
16+
<string>v1.0.29</string>
1717
<key>CFBundleSignature</key>
1818
<string>????</string>
1919
<key>CFBundleVersion</key>
20-
<string>ee22656</string>
20+
<string>c6ccbb5</string>
2121
<key>GitHash</key>
22-
<string>ee22656a4bdce133cbcf134951c0b9b07b57c05e</string>
22+
<string>c6ccbb50a317ad9e43c96c4e3d501b47081b49b8</string>
2323
<key>LSMinimumSystemVersion</key>
2424
<string>14.0</string>
2525
<key>NSHumanReadableCopyright</key>

0 commit comments

Comments
 (0)