mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 16:23:32 +01:00
Adds basic MyAppsViewController implementation
This commit is contained in:
@@ -48,6 +48,8 @@ class AppDetailViewController: UITableViewController
|
||||
self.tableView.delegate = self
|
||||
self.screenshotsCollectionView.dataSource = self.screenshotsDataSource
|
||||
|
||||
self.downloadButton.activityIndicatorView.style = .white
|
||||
|
||||
self.update()
|
||||
}
|
||||
|
||||
@@ -95,6 +97,39 @@ private extension AppDetailViewController
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppDetailViewController
|
||||
{
|
||||
@IBAction func downloadApp(_ sender: UIButton)
|
||||
{
|
||||
guard self.app.installedApp == nil else { return }
|
||||
|
||||
sender.isIndicatingActivity = true
|
||||
|
||||
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
|
||||
let app = context.object(with: self.app.objectID) as! App
|
||||
|
||||
_ = InstalledApp(app: app,
|
||||
bundleIdentifier: app.identifier,
|
||||
signedDate: Date(),
|
||||
expirationDate: Date().addingTimeInterval(60 * 60 * 24 * 7),
|
||||
context: context)
|
||||
|
||||
do
|
||||
{
|
||||
try context.save()
|
||||
}
|
||||
catch
|
||||
{
|
||||
print("Failed to download app.", error)
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||
sender.isIndicatingActivity = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDetailViewController
|
||||
{
|
||||
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
|
||||
|
||||
Reference in New Issue
Block a user