Fix server selection from pull requests
This commit is contained in:
@@ -127,7 +127,7 @@ final class AppContext {
|
|||||||
|
|
||||||
private func repositoryRoot(mode: RepositoryMode) -> UIViewController {
|
private func repositoryRoot(mode: RepositoryMode) -> UIViewController {
|
||||||
if core.activeServerIndex() == nil {
|
if core.activeServerIndex() == nil {
|
||||||
return ServersViewController(context: self, destination: mode)
|
return ServersViewController(context: self)
|
||||||
}
|
}
|
||||||
return RepositoriesViewController(context: self, mode: mode)
|
return RepositoriesViewController(context: self, mode: mode)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,6 +398,16 @@ final class PullsViewController: RefreshingTableViewController {
|
|||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
navigationItem.leftBarButtonItem = UIBarButtonItem(
|
||||||
|
image: context.symbol("server.rack"),
|
||||||
|
primaryAction: UIAction { [weak self] _ in
|
||||||
|
guard let self else { return }
|
||||||
|
self.navigationController?.pushViewController(
|
||||||
|
ServersViewController(context: self.context),
|
||||||
|
animated: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
updateFilterMenu()
|
updateFilterMenu()
|
||||||
loadContent(refreshing: false)
|
loadContent(refreshing: false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ enum RepositoryMode {
|
|||||||
@MainActor
|
@MainActor
|
||||||
final class ServersViewController: UITableViewController {
|
final class ServersViewController: UITableViewController {
|
||||||
private let context: AppContext
|
private let context: AppContext
|
||||||
private let destination: RepositoryMode
|
|
||||||
private var servers: [ServerRow] = []
|
private var servers: [ServerRow] = []
|
||||||
|
|
||||||
init(context: AppContext, destination: RepositoryMode) {
|
init(context: AppContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.destination = destination
|
|
||||||
super.init(style: .plain)
|
super.init(style: .plain)
|
||||||
title = "Servers"
|
title = "Servers"
|
||||||
tableView.backgroundColor = .systemGroupedBackground
|
tableView.backgroundColor = .systemGroupedBackground
|
||||||
@@ -57,9 +55,6 @@ final class ServersViewController: UITableViewController {
|
|||||||
tableView.deselectRow(at: indexPath, animated: true)
|
tableView.deselectRow(at: indexPath, animated: true)
|
||||||
do {
|
do {
|
||||||
try context.selectServer(index: UInt32(indexPath.row))
|
try context.selectServer(index: UInt32(indexPath.row))
|
||||||
navigationController?.setViewControllers([
|
|
||||||
RepositoriesViewController(context: context, mode: destination),
|
|
||||||
], animated: true)
|
|
||||||
} catch {
|
} catch {
|
||||||
show(error: error)
|
show(error: error)
|
||||||
}
|
}
|
||||||
@@ -211,7 +206,7 @@ final class RepositoriesViewController: RefreshingTableViewController {
|
|||||||
primaryAction: UIAction { [weak self] _ in
|
primaryAction: UIAction { [weak self] _ in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
self.navigationController?.pushViewController(
|
self.navigationController?.pushViewController(
|
||||||
ServersViewController(context: self.context, destination: self.mode),
|
ServersViewController(context: self.context),
|
||||||
animated: true
|
animated: true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user