Closed shop
This commit is contained in:
parent
9e198fe9a9
commit
0749bf2222
|
@ -53,22 +53,22 @@ public class AppDelegate: NSObject, UIWindowSceneDelegate, Sendable, UIApplicati
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function uses the REAL customer info to access the premium state
|
/// This function uses the REAL customer info to access the premium state
|
||||||
static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
// static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
||||||
Purchases.shared.getCustomerInfo { (customerInfo, error) in
|
// Purchases.shared.getCustomerInfo { (customerInfo, error) in
|
||||||
guard let error else {
|
// guard let error else {
|
||||||
let hasPrem: Bool = hasActuallyPlus(customerInfo: customerInfo)
|
// let hasPrem: Bool = hasActuallyPlus(customerInfo: customerInfo)
|
||||||
completionHandler(hasPrem)
|
// completionHandler(hasPrem)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
fatalError(error.localizedDescription)
|
// fatalError(error.localizedDescription)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// This function returns a fake "true" value every time whatever the customer info is
|
/// This function returns a fake "true" value every time whatever the customer info is
|
||||||
// static func hasPlus() -> Bool {
|
static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
||||||
// self.premium = true
|
self.premium = true
|
||||||
// return true
|
completionHandler(true)
|
||||||
// }
|
}
|
||||||
|
|
||||||
private static func hasActuallyPlus(customerInfo: CustomerInfo?) -> Bool {
|
private static func hasActuallyPlus(customerInfo: CustomerInfo?) -> Bool {
|
||||||
return customerInfo?.entitlements[PlusEntitlements.lifetime.getEntitlementId()]?.isActive == true || customerInfo?.entitlements[PlusEntitlements.monthly.getEntitlementId()]?.isActive == true || customerInfo?.entitlements[PlusEntitlements.yearly.getEntitlementId()]?.isActive == true
|
return customerInfo?.entitlements[PlusEntitlements.lifetime.getEntitlementId()]?.isActive == true || customerInfo?.entitlements[PlusEntitlements.monthly.getEntitlementId()]?.isActive == true || customerInfo?.entitlements[PlusEntitlements.yearly.getEntitlementId()]?.isActive == true
|
||||||
|
|
|
@ -13,7 +13,7 @@ public struct ShopView: View {
|
||||||
@State private var purchaseError: Bool = false
|
@State private var purchaseError: Bool = false
|
||||||
@State private var hasSub: Bool = false
|
@State private var hasSub: Bool = false
|
||||||
|
|
||||||
@State private var canPay: Bool = true
|
@State private var canPay: Bool = false
|
||||||
|
|
||||||
@State private var displayErr: Bool = false
|
@State private var displayErr: Bool = false
|
||||||
@State private var strErr: String = "Bbl404"
|
@State private var strErr: String = "Bbl404"
|
||||||
|
@ -116,6 +116,14 @@ public struct ShopView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.task {
|
.task {
|
||||||
|
#if DEBUG
|
||||||
|
self.canPay = true
|
||||||
|
#else
|
||||||
|
self.canPay = false
|
||||||
|
#endif
|
||||||
|
|
||||||
|
guard canPay else { return }
|
||||||
|
|
||||||
Purchases.shared.getOfferings { offerings, err in
|
Purchases.shared.getOfferings { offerings, err in
|
||||||
if let err {
|
if let err {
|
||||||
self.canPay = false
|
self.canPay = false
|
||||||
|
@ -140,6 +148,7 @@ public struct ShopView: View {
|
||||||
}
|
}
|
||||||
} message: {
|
} message: {
|
||||||
Text(strErr)
|
Text(strErr)
|
||||||
|
//TODO: http://rev.cat/why-are-offerings-empty issue
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $showSub) {
|
.sheet(isPresented: $showSub) {
|
||||||
ShopView.SubView()
|
ShopView.SubView()
|
||||||
|
|
Loading…
Reference in New Issue