2020-11-04 03:35:53 +01:00
|
|
|
//
|
|
|
|
// EnableExtensionPointHelpView.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Stuart Breckenridge on 4/11/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AppKit
|
|
|
|
import SwiftUI
|
|
|
|
import RSCore
|
|
|
|
|
|
|
|
struct EnableExtensionPointHelpView: View {
|
2020-11-06 12:07:28 +01:00
|
|
|
|
|
|
|
var extensionPoints: [ExtensionPoint.Type] {
|
|
|
|
let types = ExtensionPointManager.shared.availableExtensionPointTypes.filter({ $0 is SendToCommand.Type }) +
|
|
|
|
ExtensionPointManager.shared.availableExtensionPointTypes.filter({ !($0 is SendToCommand.Type) })
|
|
|
|
return types
|
|
|
|
}
|
2020-11-04 03:35:53 +01:00
|
|
|
var helpText: String
|
|
|
|
weak var preferencesController: ExtensionPointPreferencesViewController?
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
VStack {
|
|
|
|
HStack {
|
2020-11-06 12:07:28 +01:00
|
|
|
ForEach(0..<extensionPoints.count, content: { i in
|
2020-11-19 05:04:43 +01:00
|
|
|
Button(action: {
|
|
|
|
preferencesController?.enableExtensionPointFromSelection(extensionPoints[i])
|
|
|
|
}, label: {
|
|
|
|
Image(nsImage: extensionPoints[i].image)
|
|
|
|
.resizable()
|
|
|
|
.frame(width: 20, height: 20, alignment: .center)
|
|
|
|
})
|
|
|
|
.buttonStyle(PlainButtonStyle())
|
2020-11-06 12:07:28 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
if ExtensionPointManager.shared.availableExtensionPointTypes.count == 0 {
|
|
|
|
Image("markUnread")
|
|
|
|
.resizable()
|
|
|
|
.renderingMode(.template)
|
|
|
|
.frame(width: 30, height: 30, alignment: .center)
|
|
|
|
.foregroundColor(.green)
|
2020-11-04 03:35:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text(helpText)
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.padding(.top, 8)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|