From 0b3e94b974d8a24484a47776b1c4d3358229959d Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 11 Apr 2022 12:31:02 -0700 Subject: [PATCH] =?UTF-8?q?Hides=20permission=20section=20if=20app=20doesn?= =?UTF-8?q?=E2=80=99t=20list=20any=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eventually, listing permissions will be mandatory so AltStore can verify that apps only require the permissions they declare. Until then, we’ll allow apps to not list their permissions. --- .../App Detail/AppContentViewController.swift | 17 +++++++++++++---- AltStore/App Detail/AppViewController.swift | 2 +- AltStore/Base.lproj/Main.storyboard | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/AltStore/App Detail/AppContentViewController.swift b/AltStore/App Detail/AppContentViewController.swift index 9b017073..d1129d08 100644 --- a/AltStore/App Detail/AppContentViewController.swift +++ b/AltStore/App Detail/AppContentViewController.swift @@ -209,10 +209,19 @@ extension AppContentViewController override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - guard indexPath.row == Row.screenshots.rawValue else { return super.tableView(tableView, heightForRowAt: indexPath) } - - guard let size = self.preferredScreenshotSize else { return 0.0 } - return size.height + switch Row.allCases[indexPath.row] + { + case .screenshots: + guard let size = self.preferredScreenshotSize else { return 0.0 } + return size.height + + case .permissions: + guard !self.app.permissions.isEmpty else { return 0.0 } + return super.tableView(tableView, heightForRowAt: indexPath) + + default: + return super.tableView(tableView, heightForRowAt: indexPath) + } } } diff --git a/AltStore/App Detail/AppViewController.swift b/AltStore/App Detail/AppViewController.swift index 5a764f88..810a07f4 100644 --- a/AltStore/App Detail/AppViewController.swift +++ b/AltStore/App Detail/AppViewController.swift @@ -192,7 +192,7 @@ class AppViewController: UIViewController if #available(iOS 15, *) { // Fix navigation bar + tab bar appearance on iOS 15. - self.setContentScrollView(self.contentViewController.tableView) + self.setContentScrollView(self.scrollView) self.navigationItem.scrollEdgeAppearance = self.navigationController?.navigationBar.standardAppearance } } diff --git a/AltStore/Base.lproj/Main.storyboard b/AltStore/Base.lproj/Main.storyboard index 406d6fc5..be997b5d 100644 --- a/AltStore/Base.lproj/Main.storyboard +++ b/AltStore/Base.lproj/Main.storyboard @@ -412,7 +412,7 @@ - +