From b52e3c779b6f37ad5e9fab946873867dca303638 Mon Sep 17 00:00:00 2001 From: Davide Date: Thu, 14 Nov 2024 22:21:56 +0100 Subject: [PATCH] Clean up and rename beta receipt variables --- .../Domain/BundleConfiguration+AppGroup.swift | 4 ++-- .../Sources/CommonLibrary/Domain/Constants.swift | 2 +- .../Sources/CommonLibrary/Resources/Constants.json | 2 +- .../Sources/UILibrary/Business/AppContext.swift | 2 +- Passepartout/Shared/Shared+App.swift | 11 +++-------- Passepartout/Shared/Shared+Tunnel.swift | 6 +++--- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Passepartout/Library/Sources/CommonLibrary/Domain/BundleConfiguration+AppGroup.swift b/Passepartout/Library/Sources/CommonLibrary/Domain/BundleConfiguration+AppGroup.swift index 98c332b8..5a35cb56 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Domain/BundleConfiguration+AppGroup.swift +++ b/Passepartout/Library/Sources/CommonLibrary/Domain/BundleConfiguration+AppGroup.swift @@ -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) } } diff --git a/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift b/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift index 71dd109a..0943b4d9 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift +++ b/Passepartout/Library/Sources/CommonLibrary/Domain/Constants.swift @@ -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 { diff --git a/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json b/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json index d2cae28b..1e22c8ed 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json +++ b/Passepartout/Library/Sources/CommonLibrary/Resources/Constants.json @@ -24,7 +24,7 @@ "tunnel": { "profileTitleFormat": "Passepartout: %@", "refreshInterval": 3.0, - "appGroupReceiptPath": "app-group-receipt" + "betaReceiptPath": "beta-receipt" }, "api": { "timeoutInterval": 5.0 diff --git a/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift b/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift index dab28ec1..5ad0f5bc 100644 --- a/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift +++ b/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift @@ -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) diff --git a/Passepartout/Shared/Shared+App.swift b/Passepartout/Shared/Shared+App.swift index 31c5328b..b6975cea 100644 --- a/Passepartout/Shared/Shared+App.swift +++ b/Passepartout/Shared/Shared+App.swift @@ -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 } } diff --git a/Passepartout/Shared/Shared+Tunnel.swift b/Passepartout/Shared/Shared+Tunnel.swift index bdf60a92..a63e0ecd 100644 --- a/Passepartout/Shared/Shared+Tunnel.swift +++ b/Passepartout/Shared/Shared+Tunnel.swift @@ -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 } }