2019-10-21 18:51:33 +02:00
|
|
|
//
|
|
|
|
// AddLocalAccountViewController.swift
|
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 5/19/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import Account
|
|
|
|
|
2019-10-22 03:28:50 +02:00
|
|
|
class AddLocalAccountViewController: UITableViewController {
|
2019-10-21 18:51:33 +02:00
|
|
|
|
|
|
|
@IBOutlet weak var nameTextField: UITextField!
|
|
|
|
|
|
|
|
weak var delegate: AddAccountDismissDelegate?
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
2019-10-22 03:28:50 +02:00
|
|
|
navigationItem.title = Account.defaultLocalAccountName
|
2019-10-21 18:51:33 +02:00
|
|
|
nameTextField.delegate = self
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func cancel(_ sender: Any) {
|
|
|
|
dismiss(animated: true, completion: nil)
|
|
|
|
delegate?.dismiss()
|
|
|
|
}
|
|
|
|
|
2019-10-22 03:28:50 +02:00
|
|
|
@IBAction func add(_ sender: Any) {
|
2019-10-21 18:51:33 +02:00
|
|
|
let account = AccountManager.shared.createAccount(type: .onMyMac)
|
|
|
|
account.name = nameTextField.text
|
|
|
|
dismiss(animated: true, completion: nil)
|
|
|
|
delegate?.dismiss()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extension AddLocalAccountViewController: UITextFieldDelegate {
|
|
|
|
|
|
|
|
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
|
|
|
textField.resignFirstResponder()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|