From 1504a277d54c5e3249a0316c31b0b1cbc71343ac Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 25 Sep 2019 00:53:36 -0700 Subject: [PATCH] Re-enables checking if Patreon account is a patron --- AltStore/Browse/BrowseViewController.swift | 2 +- AltStore/Model/InstalledApp.swift | 4 ++-- AltStore/Model/PatreonAccount.swift | 6 +++--- AltStore/My Apps/MyAppsViewController.swift | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AltStore/Browse/BrowseViewController.swift b/AltStore/Browse/BrowseViewController.swift index ce44bdb8..b08f4d69 100644 --- a/AltStore/Browse/BrowseViewController.swift +++ b/AltStore/Browse/BrowseViewController.swift @@ -151,7 +151,7 @@ private extension BrowseViewController func updateDataSource() { - if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron + if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated { self.dataSource.predicate = nil } diff --git a/AltStore/Model/InstalledApp.swift b/AltStore/Model/InstalledApp.swift index 1c1c9add..4a7854e2 100644 --- a/AltStore/Model/InstalledApp.swift +++ b/AltStore/Model/InstalledApp.swift @@ -84,7 +84,7 @@ extension InstalledApp { var predicate = NSPredicate(format: "%K != %@", #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) - if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron + if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated { // No additional predicate } @@ -116,7 +116,7 @@ extension InstalledApp #keyPath(InstalledApp.refreshedDate), date as NSDate, #keyPath(InstalledApp.bundleIdentifier), StoreApp.altstoreAppID) - if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron + if let patreonAccount = DatabaseManager.shared.patreonAccount(in: context), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated { // No additional predicate } diff --git a/AltStore/Model/PatreonAccount.swift b/AltStore/Model/PatreonAccount.swift index b92c31c5..21fc4671 100644 --- a/AltStore/Model/PatreonAccount.swift +++ b/AltStore/Model/PatreonAccount.swift @@ -54,12 +54,12 @@ class PatreonAccount: NSManagedObject, Fetchable if let patronResponse = response.included?.first { - _ = Patron(response: patronResponse) - self.isPatron = true + let patron = Patron(response: patronResponse) + self.isPatron = (patron.status == .active) } else { - self.isPatron = true + self.isPatron = false } } } diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 4c4ea26e..813e3af8 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -320,7 +320,7 @@ private extension MyAppsViewController func updateDataSource() { - if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron + if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron, PatreonAPI.shared.isAuthenticated { self.dataSource.predicate = nil }