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)
}
public static var urlForAppGroupReceipt: URL {
cachesURL.appending(path: Constants.shared.tunnel.appGroupReceiptPath)
public static var urlForBetaReceipt: URL {
cachesURL.appending(path: Constants.shared.tunnel.betaReceiptPath)
}
}

View File

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

View File

@ -24,7 +24,7 @@
"tunnel": {
"profileTitleFormat": "Passepartout: %@",
"refreshInterval": 3.0,
"appGroupReceiptPath": "app-group-receipt"
"betaReceiptPath": "beta-receipt"
},
"api": {
"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)
if let appReceiptURL = Bundle.main.appStoreProductionReceiptURL {
let tunnelReceiptURL = BundleConfiguration.urlForAppGroupReceipt
let tunnelReceiptURL = BundleConfiguration.urlForBetaReceipt
do {
pp_log(.App.iap, .info, "Copy release receipt to tunnel...")
try? FileManager.default.removeItem(at: tunnelReceiptURL)

View File

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

View File

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