Fall back to production if beta receipt is missing (#1031)

When level is .beta, it was relying on beta receipt exclusively without
falling back to production receipt.

This was preventing the sandbox receipt ("production" in TestFlight)
from being read unless the AppUserLevel was explicitly set to .freemium
(0).
This commit is contained in:
Davide 2024-12-20 21:09:02 +01:00 committed by GitHub
parent 46d236cb5e
commit 0d3af046b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 15 deletions

View File

@ -64,7 +64,9 @@ private extension FallbackReceiptReader {
pp_log(.App.iap, .debug, "\tParse receipt for user level \(userLevel)")
if userLevel == .beta, let betaReader {
pp_log(.App.iap, .debug, "\tTestFlight, read beta receipt")
return await betaReader.receipt()
if let receipt = await betaReader.receipt() {
return receipt
}
}
pp_log(.App.iap, .debug, "\tProduction, read main receipt")
return await mainReader.receipt()

View File

@ -1,12 +0,0 @@
views.preferences.erase_icloud
views.preferences.erase_icloud.footer
views.profile.sections.name.footer
views.purchased.sections.features.header
modules.openvpn.credentials.guidance.web
modules.openvpn.remotes
features.dns
features.http_proxy
features.routing
global.actions.reconnect
errors.app.tunnel
errors.app.passepartout.missing_provider_entity

View File

@ -236,8 +236,8 @@ private extension AppContext {
private extension Dependencies {
var customUserLevel: AppUserLevel? {
guard let userLevelString = BundleConfiguration.mainIntegerIfPresent(for: .userLevel),
let userLevel = AppUserLevel(rawValue: userLevelString) else {
guard let userLevelInteger = BundleConfiguration.mainIntegerIfPresent(for: .userLevel),
let userLevel = AppUserLevel(rawValue: userLevelInteger) else {
return nil
}
return userLevel