From cd2b3eed5ee23db4a03c5eb23d79877f9ab91092 Mon Sep 17 00:00:00 2001 From: Lumaa Date: Sat, 23 Mar 2024 11:17:27 +0100 Subject: [PATCH] Improvements and minor changes --- Threaded/AppDelegate.swift | 26 +++++++++++--------- Threaded/Views/AccountView.swift | 2 +- Threaded/Views/Settings/AboutView.swift | 2 +- Threaded/Views/Settings/AppearenceView.swift | 3 ++- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Threaded/AppDelegate.swift b/Threaded/AppDelegate.swift index 6a5f7e5..7523967 100644 --- a/Threaded/AppDelegate.swift +++ b/Threaded/AppDelegate.swift @@ -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 diff --git a/Threaded/Views/AccountView.swift b/Threaded/Views/AccountView.swift index 5f72119..ead10b3 100644 --- a/Threaded/Views/AccountView.swift +++ b/Threaded/Views/AccountView.swift @@ -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) } } diff --git a/Threaded/Views/Settings/AboutView.swift b/Threaded/Views/Settings/AboutView.swift index 561be2b..de327ea 100644 --- a/Threaded/Views/Settings/AboutView.swift +++ b/Threaded/Views/Settings/AboutView.swift @@ -10,7 +10,7 @@ struct AboutView: View { List { Section(footer: Text("about.version-\(AppInfo.appVersion)")) { NavigationLink { - aboutApp + ComingSoonView() } label: { Text("about.app") } diff --git a/Threaded/Views/Settings/AppearenceView.swift b/Threaded/Views/Settings/AppearenceView.swift index b460261..b81fe02 100644 --- a/Threaded/Views/Settings/AppearenceView.swift +++ b/Threaded/Views/Settings/AppearenceView.swift @@ -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 {