Fix purchased features on Apple TV (#1083)

Refactor #1074 to show the appropriate list of eligible features in the
"Purchased" screen. The "X" signs are highly misleading.
This commit is contained in:
Davide 2025-01-19 23:09:55 +01:00 committed by GitHub
parent 66da9d165d
commit 7ecd37e6ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 4 deletions

View File

@ -35,7 +35,26 @@ extension AppProduct: AppFeatureProviding {
return AppFeature.allCases return AppFeature.allCases
case .Features.appleTV: case .Features.appleTV:
#if os(tvOS)
// treat .appleTV as full version on tvOS to cope
// with BuildProducts limitations
//
// some old iOS/macOS users are acknowledged certain
// purchases based on the build number of their first
// download, e.g. "Full version (iOS)". unfortunately,
// that build number is not the same on tvOS, so
// those purchases do not exist and the TV may complain
// about missing features other than .appleTV
//
// we avoid this by relying on iOS/macOS eligibility
// alone while only requiring .appleTV on tvOS
//
// this is a solid workaround as long as profiles are
// not editable on tvOS
return AppFeature.allCases
#else
return [.appleTV, .sharing] return [.appleTV, .sharing]
#endif
// MARK: Discontinued // MARK: Discontinued

View File

@ -48,10 +48,6 @@ extension IAPManager {
guard isEligible(for: .appleTV) else { guard isEligible(for: .appleTV) else {
throw AppError.ineligibleProfile([.appleTV]) throw AppError.ineligibleProfile([.appleTV])
} }
// require only .appleTV to cope with BuildProducts
// rely on iOS/macOS eligibility as profiles are not
// editable on tvOS
return
#endif #endif
let requiredFeatures = features.filter { let requiredFeatures = features.filter {
!isEligible(for: $0) !isEligible(for: $0)