mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-14 17:23:25 +01:00
Removes unnecessary #available checks
This commit is contained in:
@@ -95,42 +95,34 @@ private extension ErrorLogViewController
|
||||
let displayScale = (self.traitCollection.displayScale == 0.0) ? 1.0 : self.traitCollection.displayScale // 0.0 == "unspecified"
|
||||
cell.appIconImageView.layer.borderWidth = 1.0 / displayScale
|
||||
|
||||
if #available(iOS 14, *)
|
||||
let menu = UIMenu(title: "", children: [
|
||||
UIAction(title: NSLocalizedString("Copy Error Message", comment: ""), image: UIImage(systemName: "doc.on.doc")) { [weak self] _ in
|
||||
self?.copyErrorMessage(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("Copy Error Code", comment: ""), image: UIImage(systemName: "doc.on.doc")) { [weak self] _ in
|
||||
self?.copyErrorCode(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("Search FAQ", comment: ""), image: UIImage(systemName: "magnifyingglass")) { [weak self] _ in
|
||||
self?.searchFAQ(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("View More Details", comment: ""), image: UIImage(systemName: "ellipsis.circle")) { [weak self] _ in
|
||||
self?.viewMoreDetails(for: loggedError)
|
||||
},
|
||||
])
|
||||
|
||||
cell.menuButton.menu = menu
|
||||
|
||||
if self.isScrolling
|
||||
{
|
||||
let menu = UIMenu(title: "", children: [
|
||||
UIAction(title: NSLocalizedString("Copy Error Message", comment: ""), image: UIImage(systemName: "doc.on.doc")) { [weak self] _ in
|
||||
self?.copyErrorMessage(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("Copy Error Code", comment: ""), image: UIImage(systemName: "doc.on.doc")) { [weak self] _ in
|
||||
self?.copyErrorCode(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("Search FAQ", comment: ""), image: UIImage(systemName: "magnifyingglass")) { [weak self] _ in
|
||||
self?.searchFAQ(for: loggedError)
|
||||
},
|
||||
UIAction(title: NSLocalizedString("View More Details", comment: ""), image: UIImage(systemName: "ellipsis.circle")) { [weak self] _ in
|
||||
self?.viewMoreDetails(for: loggedError)
|
||||
},
|
||||
])
|
||||
|
||||
cell.menuButton.menu = menu
|
||||
|
||||
if self.isScrolling
|
||||
{
|
||||
cell.menuButton.showsMenuAsPrimaryAction = false
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.menuButton.showsMenuAsPrimaryAction = true
|
||||
}
|
||||
|
||||
cell.selectionStyle = .none
|
||||
cell.menuButton.showsMenuAsPrimaryAction = false
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allow table view selections
|
||||
cell.menuButton.isUserInteractionEnabled = false
|
||||
cell.menuButton.showsMenuAsPrimaryAction = true
|
||||
}
|
||||
|
||||
cell.selectionStyle = .none
|
||||
|
||||
// Include errorDescriptionTextView's text in cell summary.
|
||||
cell.accessibilityLabel = [cell.errorFailureLabel.text, cell.dateLabel.text, cell.errorCodeLabel.text, cell.errorDescriptionTextView.text].compactMap { $0 }.joined(separator: ". ")
|
||||
|
||||
@@ -272,31 +264,6 @@ private extension ErrorLogViewController
|
||||
|
||||
extension ErrorLogViewController
|
||||
{
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
|
||||
{
|
||||
guard #unavailable(iOS 14) else { return }
|
||||
|
||||
let loggedError = self.dataSource.item(at: indexPath)
|
||||
|
||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
||||
alertController.addAction(UIAlertAction(title: UIAlertAction.cancel.title, style: UIAlertAction.cancel.style) { _ in
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
})
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy Error Message", comment: ""), style: .default) { [weak self] _ in
|
||||
self?.copyErrorMessage(for: loggedError)
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
})
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy Error Code", comment: ""), style: .default) { [weak self] _ in
|
||||
self?.copyErrorCode(for: loggedError)
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
})
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Search FAQ", comment: ""), style: .default) { [weak self] _ in
|
||||
self?.searchFAQ(for: loggedError)
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
})
|
||||
self.present(alertController, animated: true)
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
|
||||
{
|
||||
let deleteAction = UIContextualAction(style: .destructive, title: NSLocalizedString("Delete", comment: "")) { _, _, completion in
|
||||
@@ -359,8 +326,6 @@ extension ErrorLogViewController
|
||||
|
||||
private func updateButtonInteractivity()
|
||||
{
|
||||
guard #available(iOS 14, *) else { return }
|
||||
|
||||
for case let cell as ErrorLogTableViewCell in self.tableView.visibleCells
|
||||
{
|
||||
if self.isScrolling
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user