From f92dd7a872f681137668352bfcc8c27c5ede9caf Mon Sep 17 00:00:00 2001 From: Jawshoeadan <62785552+jawshoeadan@users.noreply.github.com> Date: Sun, 11 Dec 2022 15:41:43 -0600 Subject: [PATCH] Remove all restrictions based on Patreon account (hopefully) --- AltStoreCore/Model/InstalledApp.swift | 36 ++++++++++++------------- AltStoreCore/Model/PatreonAccount.swift | 19 ++++++------- AltStoreCore/Patreon/PatreonAPI.swift | 2 +- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/AltStoreCore/Model/InstalledApp.swift b/AltStoreCore/Model/InstalledApp.swift index 54f8e32e..3caca0de 100644 --- a/AltStoreCore/Model/InstalledApp.swift +++ b/AltStoreCore/Model/InstalledApp.swift @@ -173,15 +173,15 @@ public extension InstalledApp { var predicate = NSPredicate(format: "%K == YES AND %K != %@", #keyPath(InstalledApp.isActive), #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) - if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated - { - // No additional predicate - } - else - { - predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, - NSPredicate(format: "%K == nil OR %K == NO", #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.isBeta))]) - } +// if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated +// { +// // No additional predicate +// } +// else +// { +// predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, +// NSPredicate(format: "%K == nil OR %K == NO", #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.isBeta))]) +// } var installedApps = InstalledApp.all(satisfying: predicate, sortedBy: [NSSortDescriptor(keyPath: \InstalledApp.expirationDate, ascending: true)], @@ -206,15 +206,15 @@ public extension InstalledApp #keyPath(InstalledApp.refreshedDate), date as NSDate, #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) - if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated - { - // No additional predicate - } - else - { - predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, - NSPredicate(format: "%K == nil OR %K == NO", #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.isBeta))]) - } +// if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated +// { +// // No additional predicate +// } +// else +// { +// predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, +// NSPredicate(format: "%K == nil OR %K == NO", #keyPath(InstalledApp.storeApp), #keyPath(InstalledApp.storeApp.isBeta))]) +// } var installedApps = InstalledApp.all(satisfying: predicate, sortedBy: [NSSortDescriptor(keyPath: \InstalledApp.expirationDate, ascending: true)], diff --git a/AltStoreCore/Model/PatreonAccount.swift b/AltStoreCore/Model/PatreonAccount.swift index 95259c1e..3b2a32b2 100644 --- a/AltStoreCore/Model/PatreonAccount.swift +++ b/AltStoreCore/Model/PatreonAccount.swift @@ -52,15 +52,16 @@ public class PatreonAccount: NSManagedObject, Fetchable self.name = response.data.attributes.full_name self.firstName = response.data.attributes.first_name - if let patronResponse = response.included?.first - { - let patron = Patron(response: patronResponse) - self.isPatron = (patron.status == .active) - } - else - { - self.isPatron = false - } +// if let patronResponse = response.included?.first +// { +// let patron = Patron(response: patronResponse) +// self.isPatron = (patron.status == .active) +// } +// else +// { +// self.isPatron = false +// } + self.isPatron = true } } diff --git a/AltStoreCore/Patreon/PatreonAPI.swift b/AltStoreCore/Patreon/PatreonAPI.swift index 92db9608..df758653 100644 --- a/AltStoreCore/Patreon/PatreonAPI.swift +++ b/AltStoreCore/Patreon/PatreonAPI.swift @@ -271,7 +271,7 @@ public extension PatreonAPI if let context = account.managedObjectContext, !account.isPatron { // Deactivate all beta apps now that we're no longer a patron. - self.deactivateBetaApps(in: context) + //self.deactivateBetaApps(in: context) } try account.managedObjectContext?.save()