Skip to content

Commit

Permalink
Merge branch 'main' into activity-viewer-inactive-state
Browse files Browse the repository at this point in the history
  • Loading branch information
austincondiff authored Jan 16, 2025
2 parents c4999e2 + a1d4da4 commit dbee3f4
Show file tree
Hide file tree
Showing 46 changed files with 826 additions and 329 deletions.
87 changes: 69 additions & 18 deletions CodeEdit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BE487EB28245162003F3F64"
BuildableName = "OpenWithCodeEdit.appex"
BlueprintName = "OpenWithCodeEdit"
ReferencedContainer = "container:CodeEdit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
BuildableName = "CodeEdit.app"
BlueprintName = "CodeEdit"
ReferencedContainer = "container:CodeEdit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
BuildableName = "CodeEdit.app"
BlueprintName = "CodeEdit"
ReferencedContainer = "container:CodeEdit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
BuildableName = "CodeEdit.app"
BlueprintName = "CodeEdit"
ReferencedContainer = "container:CodeEdit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 2 additions & 0 deletions CodeEdit/Features/ActivityViewer/ActivityViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@ struct ActivityViewer: View {
.opacity(0.1)
}
}
.accessibilityElement(children: .contain)
.accessibilityLabel("Activity Viewer")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ struct CECircularProgressView: View {
.font(.caption)
}
}
.accessibilityElement()
.accessibilityAddTraits(.updatesFrequently)
.accessibilityValue(
progress != nil ? Text(progress!, format: .percent) : Text("working")
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ struct TaskNotificationView: View {
.padding(.trailing, 3)
.popover(isPresented: $isPresented, arrowEdge: .bottom) {
TaskNotificationsDetailView(taskNotificationHandler: taskNotificationHandler)
}.onTapGesture {
}
.onTapGesture {
self.isPresented.toggle()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI
struct OptionMenuItemView: View {
var label: String
var action: () -> Void

var body: some View {
HStack {
Text(label)
Expand All @@ -22,6 +23,11 @@ struct OptionMenuItemView: View {
.onTapGesture {
action()
}
.accessibilityElement()
.accessibilityAction {
action()
}
.accessibilityLabel(label)
}
}

Expand Down
75 changes: 46 additions & 29 deletions CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ struct SchemeDropDownView: View {
workspaceSettingsManager.settings.project.projectName
}

/// Resolves the name one step further than `workspaceName`.
var workspaceDisplayName: String {
workspaceName.isEmpty
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
: workspaceName
}

var body: some View {
HStack(spacing: 6) {
Image(systemName: "folder.badge.gearshape")
.imageScale(.medium)
Text(
workspaceName.isEmpty
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
: workspaceName
)
.frame(minWidth: 0)
Text(workspaceDisplayName)
.frame(minWidth: 0)
}
.opacity(activeState == .inactive ? 0.4 : 1.0)
.font(.subheadline)
Expand All @@ -59,31 +62,19 @@ struct SchemeDropDownView: View {
self.isHoveringScheme = hovering
})
.instantPopover(isPresented: $isSchemePopOverPresented, arrowEdge: .bottom) {
VStack(alignment: .leading, spacing: 0) {
WorkspaceMenuItemView(
workspaceFileManager: workspaceFileManager,
item: workspaceFileManager?.workspaceItem
)
Divider()
.padding(.vertical, 5)
Group {
OptionMenuItemView(label: "Add Folder...") {
// TODO: Implment Add Folder
print("NOT IMPLEMENTED")
}
OptionMenuItemView(label: "Workspace Settings...") {
NSApp.sendAction(
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
)
}
}
}
.font(.subheadline)
.padding(5)
.frame(minWidth: 215)
popoverContent
}
.onTapGesture {
self.isSchemePopOverPresented.toggle()
isSchemePopOverPresented.toggle()
}
.accessibilityElement(children: .combine)
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("SchemeDropdown")
.accessibilityValue(workspaceDisplayName)
.accessibilityLabel("Active Scheme")
.accessibilityHint("Open the active scheme menu")
.accessibilityAction {
isSchemePopOverPresented.toggle()
}
}

Expand All @@ -102,6 +93,32 @@ struct SchemeDropDownView: View {
.font(.system(size: 8, weight: .semibold, design: .default))
.padding(.top, 0.5)
}

@ViewBuilder var popoverContent: some View {
VStack(alignment: .leading, spacing: 0) {
WorkspaceMenuItemView(
workspaceFileManager: workspaceFileManager,
item: workspaceFileManager?.workspaceItem
)
Divider()
.padding(.vertical, 5)
Group {
OptionMenuItemView(label: "Add Folder...") {
// TODO: Implment Add Folder
print("NOT IMPLEMENTED")
}
.disabled(true)
OptionMenuItemView(label: "Workspace Settings...") {
NSApp.sendAction(
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
)
}
}
}
.font(.subheadline)
.padding(5)
.frame(minWidth: 215)
}
}

// #Preview {
Expand Down
15 changes: 13 additions & 2 deletions CodeEdit/Features/ActivityViewer/Tasks/TaskDropDownView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,21 @@ struct TaskDropDownView: View {
.onHover { hovering in
self.isHoveringTasks = hovering
}
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .bottom) {
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .top) {
taskPopoverContent
}
.onTapGesture {
self.isTaskPopOverPresented.toggle()
}
.accessibilityElement(children: .combine)
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("TaskDropdown")
.accessibilityValue(taskManager.selectedTask?.name ?? "Create Tasks")
.accessibilityLabel("Active Task")
.accessibilityHint("Open the active task menu")
.accessibilityAction {
isTaskPopOverPresented = true
}
}

private var backgroundColor: some View {
Expand Down Expand Up @@ -76,7 +85,9 @@ struct TaskDropDownView: View {
VStack(alignment: .leading, spacing: 0) {
if !taskManager.availableTasks.isEmpty {
ForEach(taskManager.availableTasks, id: \.id) { task in
TasksPopoverMenuItem(taskManager: taskManager, task: task)
TasksPopoverMenuItem(taskManager: taskManager, task: task) {
isTaskPopOverPresented = false
}
}
Divider()
.padding(.vertical, 5)
Expand Down
2 changes: 2 additions & 0 deletions CodeEdit/Features/ActivityViewer/Tasks/TaskView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ struct TaskView: View {
.frame(width: 5, height: 5)
.padding(.trailing, 2.5)
}
.accessibilityElement()
.accessibilityLabel(task.name)
}
}
21 changes: 14 additions & 7 deletions CodeEdit/Features/ActivityViewer/Tasks/TasksPopoverMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

import SwiftUI

/// - Note: This view **cannot** use the `dismiss` environment value to dismiss the sheet. It has to negate the boolean
/// value that presented it initially.
/// See ``SwiftUI/View/instantPopover(isPresented:arrowEdge:content:)``
struct TasksPopoverMenuItem: View {
@Environment(\.dismiss)
private var dismiss

@ObservedObject var taskManager: TaskManager
var task: CETask
var dismiss: () -> Void

var body: some View {
HStack(spacing: 5) {
Expand All @@ -22,11 +23,12 @@ struct TasksPopoverMenuItem: View {
.padding(.vertical, 4)
.padding(.horizontal, 8)
.modifier(DropdownMenuItemStyleModifier())
.onTapGesture {
taskManager.selectedTaskID = task.id
dismiss()
}
.onTapGesture(perform: selectAction)
.clipShape(RoundedRectangle(cornerRadius: 5))
.accessibilityElement()
.accessibilityLabel(task.name)
.accessibilityAction(.default, selectAction)
.accessibilityAddTraits(taskManager.selectedTaskID == task.id ? [.isSelected] : [])
}

private var selectionIndicator: some View {
Expand All @@ -52,4 +54,9 @@ struct TasksPopoverMenuItem: View {
}
}
}

private func selectAction() {
taskManager.selectedTaskID = task.id
dismiss()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ struct WorkspaceMenuItemView: View {
.padding(.vertical, 4)
.padding(.horizontal, 8)
.modifier(DropdownMenuItemStyleModifier())
.onTapGesture { }
.onTapGesture { } // add accessibility action when this is filled in
.clipShape(RoundedRectangle(cornerRadius: 5))
.accessibilityElement()
.accessibilityLabel(item?.name ?? "")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct AddCETaskView: View {
}
.padding()
}
.accessibilityIdentifier("AddTaskView")
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct CETaskFormView: View {
TextField(text: $task.name) {
Text("Name")
}
.accessibilityLabel("Task Name")
Picker("Target", selection: $task.target) {
Text("My Mac")
.tag("My Mac")
Expand All @@ -32,12 +33,14 @@ struct CETaskFormView: View {
Text("Docker Compose")
.tag("Docker Compose")
}
.disabled(true)
}

Section {
TextField(text: $task.command) {
Text("Task")
}
.accessibilityLabel("Task Command")
TextField(text: $task.workingDirectory) {
Text("Working Directory")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct CEWorkspaceSettingsTaskListView: View {

@Binding var selectedTaskID: UUID?
@Binding var showAddTaskSheet: Bool

var body: some View {
if settings.tasks.isEmpty {
Text("No tasks")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ struct CEWorkspaceSettingsView: View {
"Name",
text: $workspaceSettingsManager.settings.project.projectName
)
.accessibilityLabel("Workspace Name")
} header: {
Text("Workspace")
.accessibilityHidden(true)
}

Section {
Expand Down
Loading

0 comments on commit dbee3f4

Please sign in to comment.