Propagate addShortcut delegation in ConnectTo
This commit is contained in:
parent
05ba654b2f
commit
d29aafe08e
|
@ -29,9 +29,9 @@ import Passepartout_Core
|
|||
|
||||
@available(iOS 12, *)
|
||||
protocol ShortcutsAddViewControllerDelegate: class {
|
||||
func shortcutAddController(_ controller: ShortcutsAddViewController, voiceShortcut: INVoiceShortcut)
|
||||
func shortcutAddController(_ controller: UIViewController?, voiceShortcut: INVoiceShortcut)
|
||||
|
||||
func shortcutAddControllerDidCancel(_ controller: ShortcutsAddViewController)
|
||||
func shortcutAddControllerDidCancel(_ controller: UIViewController?)
|
||||
}
|
||||
|
||||
@available(iOS 12, *)
|
||||
|
@ -157,6 +157,12 @@ class ShortcutsAddViewController: UITableViewController, INUIAddVoiceShortcutVie
|
|||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if let vc = segue.destination as? ShortcutsConnectToViewController {
|
||||
vc.delegate = delegate
|
||||
}
|
||||
}
|
||||
|
||||
private func addConnect() {
|
||||
guard TransientStore.shared.service.hasProfiles() else {
|
||||
|
|
|
@ -38,6 +38,8 @@ class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewC
|
|||
|
||||
private var selectedProfile: ConnectionProfile?
|
||||
|
||||
weak var delegate: ShortcutsAddViewControllerDelegate?
|
||||
|
||||
// MARK: TableModelHost
|
||||
|
||||
let model: TableModel<SectionType, RowType> = {
|
||||
|
@ -187,11 +189,14 @@ class ShortcutsConnectToViewController: UITableViewController, ProviderPoolViewC
|
|||
// MARK: INUIAddVoiceShortcutViewControllerDelegate
|
||||
|
||||
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
|
||||
navigationController?.popViewController(animated: true)
|
||||
dismiss(animated: true, completion: nil)
|
||||
guard let voiceShortcut = voiceShortcut else {
|
||||
delegate?.shortcutAddControllerDidCancel(nil)
|
||||
return
|
||||
}
|
||||
delegate?.shortcutAddController(nil, voiceShortcut: voiceShortcut)
|
||||
}
|
||||
|
||||
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
delegate?.shortcutAddControllerDidCancel(nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ class ShortcutsEditViewController: UITableViewController, INUIEditVoiceShortcutV
|
|||
|
||||
// MARK: ShortcutsAddViewControllerDelegate
|
||||
|
||||
func shortcutAddController(_ controller: ShortcutsAddViewController, voiceShortcut: INVoiceShortcut) {
|
||||
func shortcutAddController(_ controller: UIViewController?, voiceShortcut: INVoiceShortcut) {
|
||||
wrappers?.append(ShortcutWrapper.from(voiceShortcut))
|
||||
wrappers?.sort()
|
||||
reloadModel()
|
||||
|
@ -205,7 +205,7 @@ class ShortcutsEditViewController: UITableViewController, INUIEditVoiceShortcutV
|
|||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func shortcutAddControllerDidCancel(_ controller: ShortcutsAddViewController) {
|
||||
func shortcutAddControllerDidCancel(_ controller: UIViewController?) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue