@@ -25,35 +25,30 @@ public final class Flagsmith: @unchecked Sendable {
2525 /// User-Agent header value for HTTP requests
2626 /// Format: flagsmith-swift-ios-sdk/<version>
2727 /// Falls back to "unknown" if version is not discoverable at runtime
28- public static var userAgent : String {
28+ public static let userAgent : String {
2929 let version = getSDKVersion ( )
3030 return " flagsmith-swift-ios-sdk/ \( version) "
3131 }
3232
3333 /// Get the SDK version from the bundle at runtime
3434 /// Falls back to hardcoded constant or "unknown" if version is not discoverable
3535 private static func getSDKVersion( ) -> String {
36- // Try to get version from the FlagsmithClient bundle first (CocoaPods)
36+ // Try CocoaPods bundle first
3737 if let bundle = Bundle ( identifier: " org.cocoapods.FlagsmithClient " ) ,
38- let version = bundle. infoDictionary ? [ " CFBundleShortVersionString " ] as? String ,
39- !version. isEmpty && version != " 1.0 " {
38+ let version = bundle. infoDictionary ? [ " CFBundleShortVersionString " ] as? String ,
39+ !version. isEmpty,
40+ version. range ( of: #"^\d+\.\d+\.\d+"# , options: . regularExpression) != nil {
4041 return version
4142 }
4243
43- // Try to get version from the current bundle (for SPM or direct integration)
44- if let version = Bundle ( for: Flagsmith . self) . infoDictionary ? [ " CFBundleShortVersionString " ] as? String ,
45- !version. isEmpty && version != " 1.0 " {
44+ // Try SPM bundle
45+ if let version = Bundle ( for: Flagsmith . self) . infoDictionary ? [ " CFBundleShortVersionString " ] as? String ,
46+ !version. isEmpty,
47+ version. range ( of: #"^\d+\.\d+\.\d+"# , options: . regularExpression) != nil {
4648 return version
4749 }
4850
49- // Try to get version from the main bundle as last resort (but avoid app versions)
50- if let version = Bundle . main. infoDictionary ? [ " CFBundleShortVersionString " ] as? String ,
51- !version. isEmpty && version != " 1.0 " && version. range ( of: #"^\d+\.\d+\.\d+$"# , options: NSString . CompareOptions. regularExpression) != nil {
52- return version
53- }
54-
55- // Fallback to hardcoded SDK version constant
56- return sdkVersionConstant
51+ return " unknown "
5752 }
5853 private let apiManager : APIManager
5954 private let sseManager : SSEManager
0 commit comments