Files
GitHawk/Classes/View Controllers/RootViewControllers.swift
James Sherlock f40557eeaf Native Create Issue (#311)
* Add a "Create Issue" view controller, Hook up networking, Enable bug reporting

* Add create issue button to all repos

* Fix navigation for tablet, Add markdown controls view

* Remove new issue button if issues are not enabled

* Add localization for new issue text

* Update scrollView insets on keyboard, Add slight background

* More style changes, moved preview to it's own button, expanding text view, return takes you to next field

* Update bug report repository

* Design changes

* Add markdown controls to new issue
2017-09-25 11:24:14 -04:00

52 lines
2.0 KiB
Swift

//
// RootViewControllers.swift
// Freetime
//
// Created by Ryan Nystrom on 5/17/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import UIKit
func newSettingsRootViewController(
sessionManager: GithubSessionManager,
client: GithubClient,
rootNavigationManager: RootNavigationManager
) -> UIViewController {
guard let controller = UIStoryboard(name: "Settings", bundle: nil).instantiateInitialViewController()
else { fatalError("Could not unpack settings storyboard") }
if let nav = controller as? UINavigationController,
let first = nav.viewControllers.first as? SettingsViewController {
first.client = client
first.sessionManager = sessionManager
first.rootNavigationManager = rootNavigationManager
nav.tabBarItem.title = NSLocalizedString("Settings", comment: "")
nav.tabBarItem.image = UIImage(named: "tab-gear")
nav.tabBarItem.selectedImage = UIImage(named: "tab-gear-selected")
}
return controller
}
func newNotificationsRootViewController(client: GithubClient) -> UIViewController {
let controller = NotificationsViewController(client: client)
let title = NSLocalizedString("Inbox", comment: "")
controller.navigationItem.title = title
controller.navigationItem.backBarButtonItem = UIBarButtonItem(title: " ", style: .plain, target: nil, action: nil)
let nav = UINavigationController(rootViewController: controller)
nav.tabBarItem.title = title
nav.tabBarItem.image = UIImage(named: "tab-inbox")
nav.tabBarItem.selectedImage = UIImage(named: "tab-inbox-selected")
return nav
}
func newSearchRootViewController(client: GithubClient) -> UIViewController {
let controller = SearchViewController(client: client)
let nav = UINavigationController(rootViewController: controller)
nav.tabBarItem.title = NSLocalizedString("Search", comment: "")
nav.tabBarItem.image = UIImage(named: "tab-search")
nav.tabBarItem.selectedImage = UIImage(named: "tab-search-selected")
return nav
}