Find out version/build statically
Assume bundle and info dictionary are never nil.
This commit is contained in:
parent
fdb8762814
commit
567ddd9b12
|
@ -27,9 +27,7 @@ import TunnelKit
|
||||||
|
|
||||||
class PacketTunnelProvider: TunnelKitProvider {
|
class PacketTunnelProvider: TunnelKitProvider {
|
||||||
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
|
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
|
||||||
if let version = GroupConstants.App.version {
|
appVersion = "\(GroupConstants.App.name) \(GroupConstants.App.versionString)"
|
||||||
appVersion = "\(GroupConstants.App.name) \(version)"
|
|
||||||
}
|
|
||||||
dnsTimeout = GroupConstants.VPN.dnsTimeout
|
dnsTimeout = GroupConstants.VPN.dnsTimeout
|
||||||
logSeparator = GroupConstants.VPN.sessionMarker
|
logSeparator = GroupConstants.VPN.sessionMarker
|
||||||
super.startTunnel(options: options, completionHandler: completionHandler)
|
super.startTunnel(options: options, completionHandler: completionHandler)
|
||||||
|
|
|
@ -34,14 +34,11 @@ class GroupConstants {
|
||||||
static let title = name
|
static let title = name
|
||||||
// static let title = "\u{1F511}"
|
// static let title = "\u{1F511}"
|
||||||
|
|
||||||
static var version: String? {
|
static let versionNumber = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
|
||||||
guard let info = Bundle.main.infoDictionary else {
|
|
||||||
return nil
|
static let buildNumber = Int(Bundle.main.infoDictionary![kCFBundleVersionKey as String] as! String)!
|
||||||
}
|
|
||||||
let versionNumber = info["CFBundleShortVersionString"] as! String
|
static let versionString = "\(versionNumber) (\(buildNumber))"
|
||||||
let buildNumber = info[kCFBundleVersionKey as String] as! String
|
|
||||||
return "\(versionNumber) (\(buildNumber))"
|
|
||||||
}
|
|
||||||
|
|
||||||
static let teamId = "5357M5NW9W"
|
static let teamId = "5357M5NW9W"
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,8 @@ struct DebugLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
func decoratedString() -> String {
|
func decoratedString() -> String {
|
||||||
guard let appVersion = GroupConstants.App.version else {
|
|
||||||
fatalError("Could not find bundle app version?")
|
|
||||||
}
|
|
||||||
let appName = GroupConstants.App.name
|
let appName = GroupConstants.App.name
|
||||||
|
let appVersion = GroupConstants.App.versionString
|
||||||
|
|
||||||
var metadata: [String] = []
|
var metadata: [String] = []
|
||||||
let osVersion: String
|
let osVersion: String
|
||||||
|
|
Loading…
Reference in New Issue