Clean up and rename beta receipt variables

This commit is contained in:
Davide 2024-11-14 22:21:56 +01:00
parent 56fb220c94
commit b52e3c779b
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
6 changed files with 11 additions and 16 deletions

View File

@ -37,8 +37,8 @@ extension BundleConfiguration {
cachesURL.appending(path: Constants.shared.log.tunnelPath) cachesURL.appending(path: Constants.shared.log.tunnelPath)
} }
public static var urlForAppGroupReceipt: URL { public static var urlForBetaReceipt: URL {
cachesURL.appending(path: Constants.shared.tunnel.appGroupReceiptPath) cachesURL.appending(path: Constants.shared.tunnel.betaReceiptPath)
} }
} }

View File

@ -98,7 +98,7 @@ public struct Constants: Decodable, Sendable {
public let refreshInterval: TimeInterval public let refreshInterval: TimeInterval
public let appGroupReceiptPath: String public let betaReceiptPath: String
} }
public struct API: Decodable, Sendable { public struct API: Decodable, Sendable {

View File

@ -24,7 +24,7 @@
"tunnel": { "tunnel": {
"profileTitleFormat": "Passepartout: %@", "profileTitleFormat": "Passepartout: %@",
"refreshInterval": 3.0, "refreshInterval": 3.0,
"appGroupReceiptPath": "app-group-receipt" "betaReceiptPath": "beta-receipt"
}, },
"api": { "api": {
"timeoutInterval": 5.0 "timeoutInterval": 5.0

View File

@ -117,7 +117,7 @@ private extension AppContext {
// copy release receipt to tunnel for TestFlight eligibility (once is enough, it won't change) // copy release receipt to tunnel for TestFlight eligibility (once is enough, it won't change)
if let appReceiptURL = Bundle.main.appStoreProductionReceiptURL { if let appReceiptURL = Bundle.main.appStoreProductionReceiptURL {
let tunnelReceiptURL = BundleConfiguration.urlForAppGroupReceipt let tunnelReceiptURL = BundleConfiguration.urlForBetaReceipt
do { do {
pp_log(.App.iap, .info, "Copy release receipt to tunnel...") pp_log(.App.iap, .info, "Copy release receipt to tunnel...")
try? FileManager.default.removeItem(at: tunnelReceiptURL) try? FileManager.default.removeItem(at: tunnelReceiptURL)

View File

@ -107,18 +107,13 @@ private extension Configuration.IAPManager {
} }
return FallbackReceiptReader( return FallbackReceiptReader(
main: StoreKitReceiptReader(), main: StoreKitReceiptReader(),
beta: releaseReceiptURL.map { beta: betaReceiptURL.map {
KvittoReceiptReader(url: $0) KvittoReceiptReader(url: $0)
} }
) )
} }
static var releaseReceiptURL: URL? { static var betaReceiptURL: URL? {
guard let url = Bundle.main.appStoreReceiptURL else { Bundle.main.appStoreProductionReceiptURL
return nil
}
return url
.deletingLastPathComponent()
.appendingPathComponent("receipt") // release receipt
} }
} }

View File

@ -42,11 +42,11 @@ private extension Configuration.IAPManager {
static var tunnelReceiptReader: AppReceiptReader { static var tunnelReceiptReader: AppReceiptReader {
FallbackReceiptReader( FallbackReceiptReader(
main: StoreKitReceiptReader(), main: StoreKitReceiptReader(),
beta: KvittoReceiptReader(url: appGroupReceiptURL) beta: KvittoReceiptReader(url: betaReceiptURL)
) )
} }
static var appGroupReceiptURL: URL { static var betaReceiptURL: URL {
BundleConfiguration.urlForAppGroupReceipt // copied by ProfileProcessor BundleConfiguration.urlForBetaReceipt // copied by AppContext.onLaunch
} }
} }