Skip to content

Commit dbee3f4

Browse files
Merge branch 'main' into activity-viewer-inactive-state
2 parents c4999e2 + a1d4da4 commit dbee3f4

File tree

46 files changed

+826
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+826
-329
lines changed

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 69 additions & 18 deletions
Large diffs are not rendered by default.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1620"
4+
wasCreatedForAppExtension = "YES"
5+
version = "2.0">
6+
<BuildAction
7+
parallelizeBuildables = "YES"
8+
buildImplicitDependencies = "YES"
9+
buildArchitectures = "Automatic">
10+
<BuildActionEntries>
11+
<BuildActionEntry
12+
buildForTesting = "YES"
13+
buildForRunning = "YES"
14+
buildForProfiling = "YES"
15+
buildForArchiving = "YES"
16+
buildForAnalyzing = "YES">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "2BE487EB28245162003F3F64"
20+
BuildableName = "OpenWithCodeEdit.appex"
21+
BlueprintName = "OpenWithCodeEdit"
22+
ReferencedContainer = "container:CodeEdit.xcodeproj">
23+
</BuildableReference>
24+
</BuildActionEntry>
25+
<BuildActionEntry
26+
buildForTesting = "YES"
27+
buildForRunning = "YES"
28+
buildForProfiling = "YES"
29+
buildForArchiving = "YES"
30+
buildForAnalyzing = "YES">
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
34+
BuildableName = "CodeEdit.app"
35+
BlueprintName = "CodeEdit"
36+
ReferencedContainer = "container:CodeEdit.xcodeproj">
37+
</BuildableReference>
38+
</BuildActionEntry>
39+
</BuildActionEntries>
40+
</BuildAction>
41+
<TestAction
42+
buildConfiguration = "Debug"
43+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
44+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
45+
shouldUseLaunchSchemeArgsEnv = "YES"
46+
shouldAutocreateTestPlan = "YES">
47+
</TestAction>
48+
<LaunchAction
49+
buildConfiguration = "Debug"
50+
selectedDebuggerIdentifier = ""
51+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
52+
launchStyle = "0"
53+
askForAppToLaunch = "Yes"
54+
useCustomWorkingDirectory = "NO"
55+
ignoresPersistentStateOnLaunch = "NO"
56+
debugDocumentVersioning = "YES"
57+
debugServiceExtension = "internal"
58+
allowLocationSimulation = "YES"
59+
launchAutomaticallySubstyle = "2">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
65+
BuildableName = "CodeEdit.app"
66+
BlueprintName = "CodeEdit"
67+
ReferencedContainer = "container:CodeEdit.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</LaunchAction>
71+
<ProfileAction
72+
buildConfiguration = "Release"
73+
shouldUseLaunchSchemeArgsEnv = "YES"
74+
savedToolIdentifier = ""
75+
useCustomWorkingDirectory = "NO"
76+
debugDocumentVersioning = "YES"
77+
askForAppToLaunch = "Yes"
78+
launchAutomaticallySubstyle = "2">
79+
<BuildableProductRunnable
80+
runnableDebuggingMode = "0">
81+
<BuildableReference
82+
BuildableIdentifier = "primary"
83+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
84+
BuildableName = "CodeEdit.app"
85+
BlueprintName = "CodeEdit"
86+
ReferencedContainer = "container:CodeEdit.xcodeproj">
87+
</BuildableReference>
88+
</BuildableProductRunnable>
89+
</ProfileAction>
90+
<AnalyzeAction
91+
buildConfiguration = "Debug">
92+
</AnalyzeAction>
93+
<ArchiveAction
94+
buildConfiguration = "Release"
95+
revealArchiveInOrganizer = "YES">
96+
</ArchiveAction>
97+
</Scheme>

CodeEdit/Features/ActivityViewer/ActivityViewer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,7 @@ struct ActivityViewer: View {
5959
.opacity(0.1)
6060
}
6161
}
62+
.accessibilityElement(children: .contain)
63+
.accessibilityLabel("Activity Viewer")
6264
}
6365
}

CodeEdit/Features/ActivityViewer/Notifications/CECircularProgressView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ struct CECircularProgressView: View {
5050
.font(.caption)
5151
}
5252
}
53+
.accessibilityElement()
54+
.accessibilityAddTraits(.updatesFrequently)
55+
.accessibilityValue(
56+
progress != nil ? Text(progress!, format: .percent) : Text("working")
57+
)
5358
}
5459
}
5560

CodeEdit/Features/ActivityViewer/Notifications/TaskNotificationView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ struct TaskNotificationView: View {
5555
.padding(.trailing, 3)
5656
.popover(isPresented: $isPresented, arrowEdge: .bottom) {
5757
TaskNotificationsDetailView(taskNotificationHandler: taskNotificationHandler)
58-
}.onTapGesture {
58+
}
59+
.onTapGesture {
5960
self.isPresented.toggle()
6061
}
6162
}

CodeEdit/Features/ActivityViewer/Tasks/OptionMenuItemView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import SwiftUI
1010
struct OptionMenuItemView: View {
1111
var label: String
1212
var action: () -> Void
13+
1314
var body: some View {
1415
HStack {
1516
Text(label)
@@ -22,6 +23,11 @@ struct OptionMenuItemView: View {
2223
.onTapGesture {
2324
action()
2425
}
26+
.accessibilityElement()
27+
.accessibilityAction {
28+
action()
29+
}
30+
.accessibilityLabel(label)
2531
}
2632
}
2733

CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,19 @@ struct SchemeDropDownView: View {
2424
workspaceSettingsManager.settings.project.projectName
2525
}
2626

27+
/// Resolves the name one step further than `workspaceName`.
28+
var workspaceDisplayName: String {
29+
workspaceName.isEmpty
30+
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
31+
: workspaceName
32+
}
33+
2734
var body: some View {
2835
HStack(spacing: 6) {
2936
Image(systemName: "folder.badge.gearshape")
3037
.imageScale(.medium)
31-
Text(
32-
workspaceName.isEmpty
33-
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
34-
: workspaceName
35-
)
36-
.frame(minWidth: 0)
38+
Text(workspaceDisplayName)
39+
.frame(minWidth: 0)
3740
}
3841
.opacity(activeState == .inactive ? 0.4 : 1.0)
3942
.font(.subheadline)
@@ -59,31 +62,19 @@ struct SchemeDropDownView: View {
5962
self.isHoveringScheme = hovering
6063
})
6164
.instantPopover(isPresented: $isSchemePopOverPresented, arrowEdge: .bottom) {
62-
VStack(alignment: .leading, spacing: 0) {
63-
WorkspaceMenuItemView(
64-
workspaceFileManager: workspaceFileManager,
65-
item: workspaceFileManager?.workspaceItem
66-
)
67-
Divider()
68-
.padding(.vertical, 5)
69-
Group {
70-
OptionMenuItemView(label: "Add Folder...") {
71-
// TODO: Implment Add Folder
72-
print("NOT IMPLEMENTED")
73-
}
74-
OptionMenuItemView(label: "Workspace Settings...") {
75-
NSApp.sendAction(
76-
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
77-
)
78-
}
79-
}
80-
}
81-
.font(.subheadline)
82-
.padding(5)
83-
.frame(minWidth: 215)
65+
popoverContent
8466
}
8567
.onTapGesture {
86-
self.isSchemePopOverPresented.toggle()
68+
isSchemePopOverPresented.toggle()
69+
}
70+
.accessibilityElement(children: .combine)
71+
.accessibilityAddTraits(.isButton)
72+
.accessibilityIdentifier("SchemeDropdown")
73+
.accessibilityValue(workspaceDisplayName)
74+
.accessibilityLabel("Active Scheme")
75+
.accessibilityHint("Open the active scheme menu")
76+
.accessibilityAction {
77+
isSchemePopOverPresented.toggle()
8778
}
8879
}
8980

@@ -102,6 +93,32 @@ struct SchemeDropDownView: View {
10293
.font(.system(size: 8, weight: .semibold, design: .default))
10394
.padding(.top, 0.5)
10495
}
96+
97+
@ViewBuilder var popoverContent: some View {
98+
VStack(alignment: .leading, spacing: 0) {
99+
WorkspaceMenuItemView(
100+
workspaceFileManager: workspaceFileManager,
101+
item: workspaceFileManager?.workspaceItem
102+
)
103+
Divider()
104+
.padding(.vertical, 5)
105+
Group {
106+
OptionMenuItemView(label: "Add Folder...") {
107+
// TODO: Implment Add Folder
108+
print("NOT IMPLEMENTED")
109+
}
110+
.disabled(true)
111+
OptionMenuItemView(label: "Workspace Settings...") {
112+
NSApp.sendAction(
113+
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
114+
)
115+
}
116+
}
117+
}
118+
.font(.subheadline)
119+
.padding(5)
120+
.frame(minWidth: 215)
121+
}
105122
}
106123

107124
// #Preview {

CodeEdit/Features/ActivityViewer/Tasks/TaskDropDownView.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,21 @@ struct TaskDropDownView: View {
4343
.onHover { hovering in
4444
self.isHoveringTasks = hovering
4545
}
46-
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .bottom) {
46+
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .top) {
4747
taskPopoverContent
4848
}
4949
.onTapGesture {
5050
self.isTaskPopOverPresented.toggle()
5151
}
52+
.accessibilityElement(children: .combine)
53+
.accessibilityAddTraits(.isButton)
54+
.accessibilityIdentifier("TaskDropdown")
55+
.accessibilityValue(taskManager.selectedTask?.name ?? "Create Tasks")
56+
.accessibilityLabel("Active Task")
57+
.accessibilityHint("Open the active task menu")
58+
.accessibilityAction {
59+
isTaskPopOverPresented = true
60+
}
5261
}
5362

5463
private var backgroundColor: some View {
@@ -76,7 +85,9 @@ struct TaskDropDownView: View {
7685
VStack(alignment: .leading, spacing: 0) {
7786
if !taskManager.availableTasks.isEmpty {
7887
ForEach(taskManager.availableTasks, id: \.id) { task in
79-
TasksPopoverMenuItem(taskManager: taskManager, task: task)
88+
TasksPopoverMenuItem(taskManager: taskManager, task: task) {
89+
isTaskPopOverPresented = false
90+
}
8091
}
8192
Divider()
8293
.padding(.vertical, 5)

CodeEdit/Features/ActivityViewer/Tasks/TaskView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ struct TaskView: View {
2828
.frame(width: 5, height: 5)
2929
.padding(.trailing, 2.5)
3030
}
31+
.accessibilityElement()
32+
.accessibilityLabel(task.name)
3133
}
3234
}

CodeEdit/Features/ActivityViewer/Tasks/TasksPopoverMenuItem.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
import SwiftUI
99

10+
/// - Note: This view **cannot** use the `dismiss` environment value to dismiss the sheet. It has to negate the boolean
11+
/// value that presented it initially.
12+
/// See ``SwiftUI/View/instantPopover(isPresented:arrowEdge:content:)``
1013
struct TasksPopoverMenuItem: View {
11-
@Environment(\.dismiss)
12-
private var dismiss
13-
1414
@ObservedObject var taskManager: TaskManager
1515
var task: CETask
16+
var dismiss: () -> Void
1617

1718
var body: some View {
1819
HStack(spacing: 5) {
@@ -22,11 +23,12 @@ struct TasksPopoverMenuItem: View {
2223
.padding(.vertical, 4)
2324
.padding(.horizontal, 8)
2425
.modifier(DropdownMenuItemStyleModifier())
25-
.onTapGesture {
26-
taskManager.selectedTaskID = task.id
27-
dismiss()
28-
}
26+
.onTapGesture(perform: selectAction)
2927
.clipShape(RoundedRectangle(cornerRadius: 5))
28+
.accessibilityElement()
29+
.accessibilityLabel(task.name)
30+
.accessibilityAction(.default, selectAction)
31+
.accessibilityAddTraits(taskManager.selectedTaskID == task.id ? [.isSelected] : [])
3032
}
3133

3234
private var selectionIndicator: some View {
@@ -52,4 +54,9 @@ struct TasksPopoverMenuItem: View {
5254
}
5355
}
5456
}
57+
58+
private func selectAction() {
59+
taskManager.selectedTaskID = task.id
60+
dismiss()
61+
}
5562
}

0 commit comments

Comments
 (0)