-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
RuleHeaderView.swift
39 lines (37 loc) · 1.04 KB
/
RuleHeaderView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Bonzai
import SwiftUI
struct RuleHeaderView: View {
@ObservedObject var applicationStore: ApplicationStore
@Binding var group: WorkflowGroup
var body: some View {
VStack(alignment: .leading) {
HStack {
GenericAppIconView(size: 24)
ZenLabel("Rules")
}
Menu("Application") {
ForEach(applicationStore.applications.lazy.filter({
if let rule = group.rule {
return !rule.bundleIdentifiers.contains($0.bundleIdentifier)
} else {
return true
}
}), id: \.path) { application in
Button {
if group.rule == .none {
group.rule = .init()
}
group.rule?.bundleIdentifiers.append(application.bundleIdentifier)
} label: {
if application.metadata.isSafariWebApp {
Text("\(application.displayName) (Safari Web App)")
} else {
Text(application.displayName)
}
}
}
}
.menuStyle(.regular)
}
}
}