mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
51 lines
1.6 KiB
Swift
51 lines
1.6 KiB
Swift
// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
public enum BuildVariant: Sendable, Equatable, CaseIterable, CustomStringConvertible {
|
|
case appStore
|
|
case development
|
|
case testFlight
|
|
case ipa
|
|
|
|
/// Non-iOS variants (may be used for copy)
|
|
case apk
|
|
case fDroid
|
|
case huawei
|
|
|
|
// stringlint:ignore_contents
|
|
public static var current: BuildVariant {
|
|
#if DEBUG
|
|
return .development
|
|
#else
|
|
|
|
let hasProvisioningProfile: Bool = (Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") != nil)
|
|
let receiptUrl: URL? = Bundle.main.appStoreReceiptURL
|
|
let hasSandboxReceipt: Bool = (receiptUrl?.lastPathComponent == "sandboxReceipt")
|
|
|
|
if !hasProvisioningProfile {
|
|
return .appStore
|
|
}
|
|
|
|
if hasSandboxReceipt {
|
|
return .testFlight
|
|
}
|
|
|
|
return .ipa
|
|
#endif
|
|
}
|
|
|
|
public var description: String {
|
|
switch self {
|
|
case .appStore: return SNUIKit.buildVariantStringProvider().appStore
|
|
case .development: return SNUIKit.buildVariantStringProvider().development
|
|
case .testFlight: return SNUIKit.buildVariantStringProvider().testFlight
|
|
case .ipa: return SNUIKit.buildVariantStringProvider().ipa
|
|
|
|
case .apk: return SNUIKit.buildVariantStringProvider().apk
|
|
case .fDroid: return SNUIKit.buildVariantStringProvider().fDroid
|
|
case .huawei: return SNUIKit.buildVariantStringProvider().huawei
|
|
}
|
|
}
|
|
}
|