- Add AppDiscovery provider for running app enumeration - Implement AppDropdownView with auto-launch functionality - Create SignalAction models for 40+ yabai commands - Build ActionBuilderView with nested parameter controls - Add LiveShellPreview for real-time shell command generation - Implement ActionValidator for conflict detection - Add migration parser for existing raw action strings - Include feature flag for safe rollout - Maintain full backward compatibility
51 lines
1004 B
Swift
51 lines
1004 B
Swift
import Foundation
|
|
import Combine
|
|
|
|
final class DiscoveryManager: ObservableObject {
|
|
static let shared = DiscoveryManager()
|
|
|
|
@Published var discoveredServices: [String] = []
|
|
@Published var selectedService: String?
|
|
|
|
private var browser: NetServiceBrowser?
|
|
private var services: [NetService] = []
|
|
|
|
private init() {
|
|
// start browsing automatically
|
|
refresh()
|
|
}
|
|
|
|
func refresh() {
|
|
discoveredServices = []
|
|
services = []
|
|
browser?.stop()
|
|
browser = NetServiceBrowser()
|
|
browser?.delegate = self
|
|
browser?.searchForServices(ofType: "_yabaipro._tcp.", inDomain: "local.")
|
|
}
|
|
|
|
func selectService(_ name: String) {
|
|
selectedService = name
|
|
}
|
|
}
|
|
|
|
extension DiscoveryManager: NetServiceBrowserDelegate {
|
|
func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) {
|
|
services.append(service)
|
|
discoveredServices.append(service.name)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|