diff --git a/Passepartout-iOS/Scenes/Organizer/ShortcutsEditViewController.swift b/Passepartout-iOS/Scenes/Organizer/ShortcutsEditViewController.swift index 21c681a4..8e8aa262 100644 --- a/Passepartout-iOS/Scenes/Organizer/ShortcutsEditViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/ShortcutsEditViewController.swift @@ -61,7 +61,9 @@ class ShortcutsEditViewController: UITableViewController, TableModelHost { }() func reloadModel() { - model.set(.shortcut, count: wrappers?.count ?? 0, in: .all) + var rows = [RowType](repeating: .shortcut, count: wrappers?.count ?? 0) + rows.append(.addShortcut) + model.set(rows, in: .all) } // MARK: UIViewController @@ -84,6 +86,12 @@ class ShortcutsEditViewController: UITableViewController, TableModelHost { } } } + + // MARK: Actions + + private func addShortcut() { + perform(segue: StoryboardSegue.Shortcuts.shortcutAddSegueIdentifier) + } private func handleShortcutsFetchError(_ error: Error?) { @@ -117,6 +125,8 @@ extension ShortcutsEditViewController { enum RowType { case shortcut + + case addShortcut } override func numberOfSections(in tableView: UITableView) -> Int { @@ -138,10 +148,16 @@ extension ShortcutsEditViewController { guard let wrapper = wrappers?[indexPath.row] else { break } + cell.apply(Theme.current) cell.leftText = wrapper.phrase cell.rightText = wrapper.intentDescription + + case .addShortcut: + cell.applyAction(Theme.current) + cell.leftText = L10n.Shortcuts.Edit.Cells.AddShortcut.caption + cell.accessoryType = .none + cell.isTappable = true } - cell.apply(Theme.current) return cell } @@ -158,6 +174,9 @@ extension ShortcutsEditViewController { vc.delegate = self editedIndexPath = indexPath present(vc, animated: true, completion: nil) + + case .addShortcut: + addShortcut() } } } diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index d14646ba..4fba270f 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -219,6 +219,7 @@ "shortcuts.edit.title" = "Manage shortcuts"; "shortcuts.edit.sections.all.header" = "Existing shortcuts"; +"shortcuts.edit.cells.add_shortcut.caption" = "Add shortcut"; "about.title" = "About"; "about.sections.web.header" = "Web"; diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 9cff6240..8e252def 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -754,6 +754,12 @@ public enum L10n { public enum Edit { /// Manage shortcuts public static let title = L10n.tr("Localizable", "shortcuts.edit.title") + public enum Cells { + public enum AddShortcut { + /// Add shortcut + public static let caption = L10n.tr("Localizable", "shortcuts.edit.cells.add_shortcut.caption") + } + } public enum Sections { public enum All { /// Existing shortcuts