Fix missing beta check on tvOS (#925)
Reuse the same receipt trick from iOS. Also, fix a regression in IAPManager.fetchLevelIfNeeded() from #903, where a guard after an await was dropped leading to reentrancy issues.
This commit is contained in:
parent
a6f132a6e6
commit
fa293656f4
|
@ -270,6 +270,9 @@ private extension IAPManager {
|
|||
return
|
||||
}
|
||||
let isBeta = await betaChecker.isBeta()
|
||||
guard userLevel == .undefined else {
|
||||
return
|
||||
}
|
||||
userLevel = isBeta ? .beta : .freemium
|
||||
pp_log(.App.iap, .info, "App level: \(userLevel)")
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ private extension TestFlightChecker {
|
|||
func verifyBetaBuild() -> Bool {
|
||||
#if os(macOS) || targetEnvironment(macCatalyst)
|
||||
isMacTestFlightBuild
|
||||
#elseif os(iOS)
|
||||
isiOSSandboxBuild
|
||||
#elseif os(iOS) || os(tvOS)
|
||||
isSandboxBuild
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
|
@ -59,12 +59,17 @@ private extension TestFlightChecker {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: iOS
|
||||
// MARK: iOS/tvOS
|
||||
|
||||
#if os(iOS)
|
||||
#if os(iOS) || os(tvOS)
|
||||
private extension TestFlightChecker {
|
||||
var isiOSSandboxBuild: Bool {
|
||||
bundle.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
|
||||
var isSandboxBuild: Bool {
|
||||
guard let url = bundle.appStoreReceiptURL else {
|
||||
NSLog("No Bundle.main.appStoreReceiptURL")
|
||||
return false
|
||||
}
|
||||
NSLog("Bundle.main.appStoreReceiptURL = \(url)")
|
||||
return bundle.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue