Prevent app themes from attempting to be deleted

This commit is contained in:
Maurice Parker
2022-02-07 16:41:00 -08:00
parent a1bfa4afdc
commit 0c183f4bdf
2 changed files with 30 additions and 33 deletions

View File

@@ -70,9 +70,10 @@ class ArticleThemesTableViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard indexPath.row != 0,
let cell = tableView.cellForRow(at: indexPath),
let themeName = cell.textLabel?.text else { return nil }
guard let cell = tableView.cellForRow(at: indexPath),
let themeName = cell.textLabel?.text,
let theme = ArticleThemesManager.shared.articleThemeWithThemeName(themeName),
!theme.isAppTheme else { return nil }
let deleteTitle = NSLocalizedString("Delete", comment: "Delete")
let deleteAction = UIContextualAction(style: .normal, title: deleteTitle) { [weak self] (action, view, completion) in