Unrestrict some features in .beta (#840)

Add these features to the .beta user level:

- .interactiveLogin
- .sharing

Fixes #662
This commit is contained in:
Davide 2024-11-10 16:53:01 +01:00 committed by GitHub
parent 3a5e3889d3
commit fdbed7442c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 11 deletions

View File

@ -32,6 +32,9 @@ protocol AppFeatureProviding {
extension AppUserLevel: AppFeatureProviding {
var features: [AppFeature] {
switch self {
case .beta:
return [.interactiveLogin, .sharing]
case .fullVersion:
return AppFeature.allButAppleTV

View File

@ -195,26 +195,33 @@ extension IAPManagerTests {
XCTAssertTrue(sut.userLevel.isRestricted)
}
func test_givenBetaApp_thenIsNotEligibleForAnyFeature() async {
func test_givenBetaApp_thenIsNotEligibleForAllFeatures() async {
let reader = MockAppReceiptReader()
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader)
await sut.reloadReceipt()
XCTAssertFalse(sut.isEligible(for: AppFeature.allButAppleTV))
XCTAssertFalse(sut.isEligible(for: AppFeature.allCases))
}
func test_givenBetaApp_thenIsEligibleForUserLevelFeatures() async {
let reader = MockAppReceiptReader()
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader)
let eligible = AppUserLevel.beta.features
await sut.reloadReceipt()
XCTAssertTrue(sut.isEligible(for: eligible))
}
func test_givenBetaApp_thenIsEligibleForUnrestrictedFeature() async {
let reader = MockAppReceiptReader()
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader, unrestrictedFeatures: [.onDemand])
var eligible = AppUserLevel.beta.features
eligible.append(.onDemand)
await sut.reloadReceipt()
AppFeature.allButAppleTV.forEach {
if $0 == .onDemand {
XCTAssertTrue(sut.isEligible(for: $0))
} else {
XCTAssertFalse(sut.isEligible(for: $0))
}
}
XCTAssertTrue(sut.isEligible(for: eligible))
}
func test_givenFullApp_thenIsFullVersion() async {

View File

@ -98,8 +98,6 @@ extension IAPManager {
customUserLevel: Configuration.Environment.userLevel,
inAppHelper: iapHelpers.productHelper,
receiptReader: iapHelpers.receiptReader,
// FIXME: #662, omit unrestrictedFeatures on release!
unrestrictedFeatures: [.interactiveLogin, .sharing],
productsAtBuild: Configuration.IAPManager.productsAtBuild
)
}()