diff --git a/Passepartout/Library/Sources/CommonLibrary/IAP/AppFeatureProviding.swift b/Passepartout/Library/Sources/CommonLibrary/IAP/AppFeatureProviding.swift index a13e76a4..3d94ea94 100644 --- a/Passepartout/Library/Sources/CommonLibrary/IAP/AppFeatureProviding.swift +++ b/Passepartout/Library/Sources/CommonLibrary/IAP/AppFeatureProviding.swift @@ -32,6 +32,9 @@ protocol AppFeatureProviding { extension AppUserLevel: AppFeatureProviding { var features: [AppFeature] { switch self { + case .beta: + return [.interactiveLogin, .sharing] + case .fullVersion: return AppFeature.allButAppleTV diff --git a/Passepartout/Library/Tests/CommonLibraryTests/IAPManagerTests.swift b/Passepartout/Library/Tests/CommonLibraryTests/IAPManagerTests.swift index 3463891c..e5f9f5cc 100644 --- a/Passepartout/Library/Tests/CommonLibraryTests/IAPManagerTests.swift +++ b/Passepartout/Library/Tests/CommonLibraryTests/IAPManagerTests.swift @@ -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 { diff --git a/Passepartout/Shared/Shared.swift b/Passepartout/Shared/Shared.swift index d4f8b29f..73236c50 100644 --- a/Passepartout/Shared/Shared.swift +++ b/Passepartout/Shared/Shared.swift @@ -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 ) }()