diff --git a/KDChat/AppInfo.swift b/KDChat/AppInfo.swift index d52c6e8..e1219bb 100644 --- a/KDChat/AppInfo.swift +++ b/KDChat/AppInfo.swift @@ -4,4 +4,33 @@ enum AppInfo { static let name = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "KDChat" static let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "–" static let build = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "–" + static let distribution = AppDistribution.current + static let testFlightURL: URL? = nil // TODO: set when TestFlight is configured +} + +enum AppDistribution: String { + case development = "Development" + case simulator = "Simulator" + case testFlight = "TestFlight" + case appStore = "App Store" + case adHoc = "Ad Hoc" + + static var current: AppDistribution { + #if targetEnvironment(simulator) + return .simulator + #else + #if DEBUG + return .development + #else + if let receiptURL = Bundle.main.appStoreReceiptURL, + receiptURL.lastPathComponent == "sandboxReceipt" { + return .testFlight + } + if Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") != nil { + return .adHoc + } + return .appStore + #endif + #endif + } } diff --git a/KDChat/Networking/ProtocolTypes.swift b/KDChat/Networking/ProtocolTypes.swift index ea37244..74dc91e 100644 --- a/KDChat/Networking/ProtocolTypes.swift +++ b/KDChat/Networking/ProtocolTypes.swift @@ -12,8 +12,8 @@ enum ServerMethod: Int32 { case leaveGame = 5 // 6 = TimeSync, 7 = RequestProfile case directMessage = 8 - // 9..19 = game-specific methods - case remoteFormEvent = 20 + // 9..20 = game-specific methods + case remoteFormEvent = 21 } // MARK: - Client Methods (server -> client) diff --git a/KDChat/Views/SettingsView.swift b/KDChat/Views/SettingsView.swift index 660002e..9048947 100644 --- a/KDChat/Views/SettingsView.swift +++ b/KDChat/Views/SettingsView.swift @@ -115,7 +115,7 @@ struct SettingsView: View { } Section { - Text("\(AppInfo.name) \(AppInfo.version) (\(AppInfo.build))") + Text("\(AppInfo.name) \(AppInfo.version) (\(AppInfo.build)) \(AppInfo.distribution.rawValue)") .foregroundStyle(.secondary) .frame(maxWidth: .infinity, alignment: .center) }