mirror of
https://github.com/lumaa-dev/BubbleApp.git
synced 2024-12-26 16:55:15 +01:00
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
|
||||
static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
||||
Purchases.shared.getCustomerInfo { (customerInfo, error) in
|
||||
guard let error else {
|
||||
let hasPrem: Bool = hasActuallyPlus(customerInfo: customerInfo)
|
||||
completionHandler(hasPrem)
|
||||
return
|
||||
}
|
||||
fatalError(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
// static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
||||
// Purchases.shared.getCustomerInfo { (customerInfo, error) in
|
||||
// guard let error else {
|
||||
// let hasPrem: Bool = hasActuallyPlus(customerInfo: customerInfo)
|
||||
// completionHandler(hasPrem)
|
||||
// return
|
||||
// }
|
||||
// fatalError(error.localizedDescription)
|
||||
// }
|
||||
// }
|
||||
|
||||
/// This function returns a fake "true" value every time whatever the customer info is
|
||||
// static func hasPlus() -> Bool {
|
||||
// self.premium = true
|
||||
// return true
|
||||
// }
|
||||
static func hasPlus(completionHandler: @escaping (Bool) -> Void) {
|
||||
self.premium = true
|
||||
completionHandler(true)
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -13,7 +13,7 @@ public struct ShopView: View {
|
||||
@State private var purchaseError: 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 strErr: String = "Bbl404"
|
||||
@ -116,6 +116,14 @@ public struct ShopView: View {
|
||||
}
|
||||
}
|
||||
.task {
|
||||
#if DEBUG
|
||||
self.canPay = true
|
||||
#else
|
||||
self.canPay = false
|
||||
#endif
|
||||
|
||||
guard canPay else { return }
|
||||
|
||||
Purchases.shared.getOfferings { offerings, err in
|
||||
if let err {
|
||||
self.canPay = false
|
||||
@ -140,6 +148,7 @@ public struct ShopView: View {
|
||||
}
|
||||
} message: {
|
||||
Text(strErr)
|
||||
//TODO: http://rev.cat/why-are-offerings-empty issue
|
||||
}
|
||||
.sheet(isPresented: $showSub) {
|
||||
ShopView.SubView()
|
||||
|
Loading…
Reference in New Issue
Block a user