Unrestrict some features in .beta (#840)
Add these features to the .beta user level: - .interactiveLogin - .sharing Fixes #662
This commit is contained in:
parent
3a5e3889d3
commit
fdbed7442c
|
@ -32,6 +32,9 @@ protocol AppFeatureProviding {
|
||||||
extension AppUserLevel: AppFeatureProviding {
|
extension AppUserLevel: AppFeatureProviding {
|
||||||
var features: [AppFeature] {
|
var features: [AppFeature] {
|
||||||
switch self {
|
switch self {
|
||||||
|
case .beta:
|
||||||
|
return [.interactiveLogin, .sharing]
|
||||||
|
|
||||||
case .fullVersion:
|
case .fullVersion:
|
||||||
return AppFeature.allButAppleTV
|
return AppFeature.allButAppleTV
|
||||||
|
|
||||||
|
|
|
@ -195,26 +195,33 @@ extension IAPManagerTests {
|
||||||
XCTAssertTrue(sut.userLevel.isRestricted)
|
XCTAssertTrue(sut.userLevel.isRestricted)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_givenBetaApp_thenIsNotEligibleForAnyFeature() async {
|
func test_givenBetaApp_thenIsNotEligibleForAllFeatures() async {
|
||||||
let reader = MockAppReceiptReader()
|
let reader = MockAppReceiptReader()
|
||||||
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader)
|
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader)
|
||||||
|
|
||||||
await sut.reloadReceipt()
|
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 {
|
func test_givenBetaApp_thenIsEligibleForUnrestrictedFeature() async {
|
||||||
let reader = MockAppReceiptReader()
|
let reader = MockAppReceiptReader()
|
||||||
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader, unrestrictedFeatures: [.onDemand])
|
let sut = IAPManager(customUserLevel: .beta, receiptReader: reader, unrestrictedFeatures: [.onDemand])
|
||||||
|
|
||||||
|
var eligible = AppUserLevel.beta.features
|
||||||
|
eligible.append(.onDemand)
|
||||||
|
|
||||||
await sut.reloadReceipt()
|
await sut.reloadReceipt()
|
||||||
AppFeature.allButAppleTV.forEach {
|
XCTAssertTrue(sut.isEligible(for: eligible))
|
||||||
if $0 == .onDemand {
|
|
||||||
XCTAssertTrue(sut.isEligible(for: $0))
|
|
||||||
} else {
|
|
||||||
XCTAssertFalse(sut.isEligible(for: $0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_givenFullApp_thenIsFullVersion() async {
|
func test_givenFullApp_thenIsFullVersion() async {
|
||||||
|
|
|
@ -98,8 +98,6 @@ extension IAPManager {
|
||||||
customUserLevel: Configuration.Environment.userLevel,
|
customUserLevel: Configuration.Environment.userLevel,
|
||||||
inAppHelper: iapHelpers.productHelper,
|
inAppHelper: iapHelpers.productHelper,
|
||||||
receiptReader: iapHelpers.receiptReader,
|
receiptReader: iapHelpers.receiptReader,
|
||||||
// FIXME: #662, omit unrestrictedFeatures on release!
|
|
||||||
unrestrictedFeatures: [.interactiveLogin, .sharing],
|
|
||||||
productsAtBuild: Configuration.IAPManager.productsAtBuild
|
productsAtBuild: Configuration.IAPManager.productsAtBuild
|
||||||
)
|
)
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue