Removes unnecessary #available checks

This commit is contained in:
Riley Testut
2023-03-02 16:53:36 -06:00
parent 15dd044be9
commit 468e912e47
18 changed files with 129 additions and 483 deletions

View File

@@ -32,14 +32,7 @@ extension SettingsViewController
fileprivate enum AppRefreshRow: Int, CaseIterable
{
case backgroundRefresh
@available(iOS 14, *)
case addToSiri
static var allCases: [AppRefreshRow] {
guard #available(iOS 14, *) else { return [.backgroundRefresh] }
return [.backgroundRefresh, .addToSiri]
}
}
fileprivate enum CreditsRow: Int, CaseIterable
@@ -460,22 +453,6 @@ extension SettingsViewController
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = super.tableView(tableView, cellForRowAt: indexPath)
if #available(iOS 14, *) {}
else if let cell = cell as? InsetGroupTableViewCell,
indexPath.section == Section.appRefresh.rawValue,
indexPath.row == AppRefreshRow.backgroundRefresh.rawValue
{
// Only one row is visible pre-iOS 14.
cell.style = .single
}
return cell
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
{
let section = Section.allCases[section]
@@ -555,9 +532,7 @@ extension SettingsViewController
switch row
{
case .backgroundRefresh: break
case .addToSiri:
guard #available(iOS 14, *) else { return }
self.addRefreshAppsShortcut()
case .addToSiri: self.addRefreshAppsShortcut()
}
case .techyThings: