Improvements and minor changes

This commit is contained in:
Lumaa 2024-03-23 11:17:27 +01:00
parent 81f2814374
commit cd2b3eed5e
4 changed files with 19 additions and 14 deletions

View File

@ -50,17 +50,21 @@ public class AppDelegate: NSObject, UIWindowSceneDelegate, Sendable, UIApplicati
return nil
}
static func hasPlus() -> Bool {
#if DEBUG
self.premium = true
return true
#else
Purchases.shared.getCustomerInfo { (customerInfo, error) in
self.premium = hasActuallyPlus(customerInfo: customerInfo)
}
return self.premium
#endif
}
/// This function uses the REAL customer info to access the premium state
// static func hasPlus() -> Bool {
// #if DEBUG
// self.premium = true
// return true
// #else
// Purchases.shared.getCustomerInfo { (customerInfo, error) in
// self.premium = hasActuallyPlus(customerInfo: customerInfo)
// }
// return self.premium
// #endif
// }
/// This function returns a fake "true" value every time whatever the customer info is
static func hasPlus() -> Bool { return 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

View File

@ -11,11 +11,11 @@ struct AccountView: View {
var body: some View {
NavigationStack(path: $navigator.path) {
ProfileView(account: account, isCurrent: true)
.environmentObject(navigator)
.withAppRouter(navigator)
.onAppear {
account = accountManager.forceAccount()
}
}
.environmentObject(navigator)
}
}

View File

@ -10,7 +10,7 @@ struct AboutView: View {
List {
Section(footer: Text("about.version-\(AppInfo.appVersion)")) {
NavigationLink {
aboutApp
ComingSoonView()
} label: {
Text("about.app")
}

View File

@ -2,9 +2,10 @@
import SwiftUI
// TODO: Show/hide profile header
struct AppearenceView: View {
@ObservedObject private var userPreferences: UserPreferences = .defaultPreferences
@EnvironmentObject private var navigator: Navigator
@Environment(\.dismiss) private var dismiss
var body: some View {