Add bare bones ProfileConfigurationTableViewController.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts
2018-05-24 22:07:04 +02:00
parent e6c6fd0b34
commit 9724073447
4 changed files with 427 additions and 3 deletions
+23 -2
View File
@@ -85,8 +85,8 @@ class AppCoordinator: RootViewCoordinator {
extension AppCoordinator: ConnectionsTableViewControllerDelegate {
func addProvider(connectionsTableViewController: ConnectionsTableViewController) {
// TODO implement
print("Add provider")
let addContext = persistentContainer.newBackgroundContext()
showProfileConfigurationViewController(profile: nil, context: addContext)
}
func connect(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
@@ -97,6 +97,23 @@ extension AppCoordinator: ConnectionsTableViewControllerDelegate {
func configure(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
// TODO implement
print("configure profile \(profile)")
let editContext = persistentContainer.newBackgroundContext()
var backgroundProfile: Profile?
editContext.performAndWait {
backgroundProfile = editContext.object(with: profile.objectID) as? Profile
}
showProfileConfigurationViewController(profile: backgroundProfile, context: editContext)
}
func showProfileConfigurationViewController(profile: Profile?, context: NSManagedObjectContext) {
let profileConfigurationViewController = storyboard.instantiateViewController(type: ProfileConfigurationTableViewController.self)
profileConfigurationViewController.viewContext = context
profileConfigurationViewController.delegate = self
self.navigationController.pushViewController(profileConfigurationViewController, animated: true)
}
func delete(profile: Profile, connectionsTableViewController: ConnectionsTableViewController) {
@@ -104,3 +121,7 @@ extension AppCoordinator: ConnectionsTableViewControllerDelegate {
print("delete profile \(profile)")
}
}
extension AppCoordinator: ProfileConfigurationTableViewControllerDelegate {
}