[AltStore] Adds basic Patreon integration

- Lists beta versions of apps when signed in to Patreon
- Lists names of Patrons with the Credits benefit
This commit is contained in:
Riley Testut
2019-08-28 11:13:22 -07:00
parent 8df4c97a74
commit eb5b1a616a
33 changed files with 1147 additions and 39 deletions

View File

@@ -39,6 +39,7 @@ class BrowseViewController: UICollectionViewController
super.viewWillAppear(animated)
self.fetchSource()
self.updateDataSource()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
@@ -80,6 +81,7 @@ private extension BrowseViewController
cell.imageURLs = Array(app.screenshotURLs.prefix(2))
cell.appIconImageView.image = nil
cell.appIconImageView.isIndicatingActivity = true
cell.betaBadgeView.isHidden = !app.isBeta
cell.actionButton.addTarget(self, action: #selector(BrowseViewController.performAppAction(_:)), for: .primaryActionTriggered)
cell.actionButton.activityIndicatorView.style = .white
@@ -138,6 +140,18 @@ private extension BrowseViewController
return dataSource
}
func updateDataSource()
{
if let patreonAccount = DatabaseManager.shared.patreonAccount(), patreonAccount.isPatron
{
self.dataSource.predicate = nil
}
else
{
self.dataSource.predicate = NSPredicate(format: "%K == NO", #keyPath(StoreApp.isBeta))
}
}
func fetchSource()
{
AppManager.shared.fetchSource() { (result) in