Explainer text for accounts and extensions
Explainer text will display when no account/extension is selected.
This commit is contained in:
parent
e9989052e5
commit
3b5dfb38ec
@ -239,6 +239,21 @@ private extension AccountsPreferencesViewController {
|
|||||||
children.removeAll()
|
children.removeAll()
|
||||||
controller.view.removeFromSuperview()
|
controller.view.removeFromSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tableView.selectedRow == -1 {
|
||||||
|
var helpText = ""
|
||||||
|
if sortedAccounts.count == 0 {
|
||||||
|
helpText = NSLocalizedString("Add an account by clicking the + button.", comment: "Add Account Explainer")
|
||||||
|
} else {
|
||||||
|
helpText = NSLocalizedString("Select an account or add a new account by clicking the + button.", comment: "Add Account Explainer")
|
||||||
|
}
|
||||||
|
|
||||||
|
let textHostingController = NSHostingController(rootView: Text(helpText).multilineTextAlignment(.center))
|
||||||
|
addChild(textHostingController)
|
||||||
|
textHostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
detailView.addSubview(textHostingController.view)
|
||||||
|
detailView.addFullSizeConstraints(forSubview: textHostingController.view)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,21 @@ private extension ExtensionPointPreferencesViewController {
|
|||||||
func showDefaultView() {
|
func showDefaultView() {
|
||||||
activeExtensionPoints = Array(ExtensionPointManager.shared.activeExtensionPoints.values).sorted(by: { $0.title < $1.title })
|
activeExtensionPoints = Array(ExtensionPointManager.shared.activeExtensionPoints.values).sorted(by: { $0.title < $1.title })
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
|
|
||||||
|
if tableView.selectedRow == -1 {
|
||||||
|
var helpText = ""
|
||||||
|
if activeExtensionPoints.count == 0 {
|
||||||
|
helpText = NSLocalizedString("Add an extension point by clicking the + button.", comment: "Extension Explainer")
|
||||||
|
} else {
|
||||||
|
helpText = NSLocalizedString("Select an extension point or add a new extension point by clicking the + button.", comment: "Extension Explainer")
|
||||||
|
}
|
||||||
|
|
||||||
|
let textHostingController = NSHostingController(rootView: Text(helpText).multilineTextAlignment(.center))
|
||||||
|
addChild(textHostingController)
|
||||||
|
textHostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
detailView.addSubview(textHostingController.view)
|
||||||
|
detailView.addFullSizeConstraints(forSubview: textHostingController.view)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func showController(_ controller: NSViewController) {
|
func showController(_ controller: NSViewController) {
|
||||||
@ -195,6 +210,21 @@ private extension ExtensionPointPreferencesViewController {
|
|||||||
children.removeAll()
|
children.removeAll()
|
||||||
controller.view.removeFromSuperview()
|
controller.view.removeFromSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tableView.selectedRow == -1 {
|
||||||
|
var helpText = ""
|
||||||
|
if activeExtensionPoints.count == 0 {
|
||||||
|
helpText = NSLocalizedString("Add an extension point by clicking the + button.", comment: "Extension Explainer")
|
||||||
|
} else {
|
||||||
|
helpText = NSLocalizedString("Select an extension point or add a new extension point by clicking the + button.", comment: "Extension Explainer")
|
||||||
|
}
|
||||||
|
|
||||||
|
let textHostingController = NSHostingController(rootView: Text(helpText).multilineTextAlignment(.center))
|
||||||
|
addChild(textHostingController)
|
||||||
|
textHostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
detailView.addSubview(textHostingController.view)
|
||||||
|
detailView.addFullSizeConstraints(forSubview: textHostingController.view)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func enableOauth1(_ provider: OAuth1SwiftProvider.Type, extensionPointType: ExtensionPoint.Type) {
|
func enableOauth1(_ provider: OAuth1SwiftProvider.Type, extensionPointType: ExtensionPoint.Type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user