Skip to content

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
LastUpgradeVersion = "2600"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
LastUpgradeVersion = "2600"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down
4 changes: 3 additions & 1 deletion CodeEdit/CodeEditApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ struct CodeEditApp: App {
OpenFileOrFolderButton(dismissWindow: dismissWindow)
},
onDrop: { url, dismissWindow in
Task { CodeEditDocumentController.shared.openDocument(at: url, onCompletion: { dismissWindow() }) }
Task {
await CodeEditDocumentController.shared.openDocument(at: url, onCompletion: { dismissWindow() })
}
}
)

Expand Down
51 changes: 35 additions & 16 deletions CodeEdit/Features/ActivityViewer/ActivityViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,41 @@ struct ActivityViewer: View {
self.taskManager = taskManager
}
var body: some View {
Group {
if #available(macOS 26, *) {
content
.fixedSize(horizontal: false, vertical: false)
.padding(5)
// TaskNotificationView doesn't have it's own padding
// Also this padding seems weird. However, we want the spinning circle to be padded with the same
// amount from both the top and bottom, as well as the trailing edge. So despite it not being exactly
// the same it *looks* correctly padded
.padding(.trailing, 5)
.clipShape(Capsule())
.frame(minWidth: 200)
} else {
content
.fixedSize(horizontal: false, vertical: false)
.padding(.horizontal, 5)
.padding(.vertical, 1.5)
.frame(height: 22)
.clipped()
.background {
if colorScheme == .dark {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
} else {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
}
}
}
}
.accessibilityElement(children: .contain)
.accessibilityLabel("Activity Viewer")
}

@ViewBuilder private var content: some View {
HStack(spacing: 0) {
SchemeDropDownView(
workspaceSettingsManager: workspaceSettingsManager,
Expand All @@ -45,21 +80,5 @@ struct ActivityViewer: View {
TaskNotificationView(taskNotificationHandler: taskNotificationHandler)
.fixedSize()
}
.fixedSize(horizontal: false, vertical: false)
.padding(.horizontal, 5)
.padding(.vertical, 1.5)
.frame(height: 22)
.clipped()
.background {
if colorScheme == .dark {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
} else {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
}
}
.accessibilityElement(children: .contain)
.accessibilityLabel("Activity Viewer")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,35 @@ struct TaskNotificationView: View {

var body: some View {
ZStack {
if let notification {
HStack {
Text(notification.title)
.font(.subheadline)
.transition(
.asymmetric(insertion: .move(edge: .top), removal: .move(edge: .bottom))
.combined(with: .opacity)
)
.id("NotificationTitle" + notification.title)

if notification.isLoading {
CECircularProgressView(
progress: notification.percentage,
currentTaskCount: taskNotificationHandler.notifications.count
)
.padding(.horizontal, -1)
.frame(height: 16)
} else {
if taskNotificationHandler.notifications.count > 1 {
Text("\(taskNotificationHandler.notifications.count)")
.font(.caption)
.padding(5)
.background(
Circle()
.foregroundStyle(.gray)
.opacity(0.2)
)
.padding(-5)
}
HStack {
if let notification {
HStack {
Text(notification.title)
.font(.subheadline)
.transition(
.asymmetric(insertion: .move(edge: .top), removal: .move(edge: .bottom))
.combined(with: .opacity)
)
.id("NotificationTitle" + notification.title)
}
.transition(.opacity.combined(with: .move(edge: .trailing)))

loaderView(notification: notification)
.transition(.opacity)
.id("Loader")
} else {
Text("")
.id("Loader")
}
.transition(.opacity.combined(with: .move(edge: .trailing)))
.opacity(activeState == .inactive ? 0.4 : 1.0)
.padding(3)
.padding(-3)
.padding(.trailing, 3)
.popover(isPresented: $isPresented, arrowEdge: .bottom) {
TaskNotificationsDetailView(taskNotificationHandler: taskNotificationHandler)
}
.onTapGesture {
self.isPresented.toggle()
}
}
.opacity(activeState == .inactive ? 0.4 : 1.0)
.padding(3)
.padding(-3)
.popover(isPresented: $isPresented, arrowEdge: .bottom) {
TaskNotificationsDetailView(taskNotificationHandler: taskNotificationHandler)
}
.onTapGesture {
self.isPresented.toggle()
}
}
.animation(.easeInOut, value: notification)
Expand All @@ -69,6 +56,33 @@ struct TaskNotificationView: View {
}
}

@ViewBuilder
private func loaderView(notification: TaskNotificationModel) -> some View {
if notification.isLoading {
CECircularProgressView(
progress: notification.percentage,
currentTaskCount: taskNotificationHandler.notifications.count
)
.if(.tahoe) {
$0.padding(.leading, 1)
} else: {
$0.padding(.horizontal, -1)
}
.frame(height: 16)
} else {
if taskNotificationHandler.notifications.count > 1 {
Text("\(taskNotificationHandler.notifications.count)")
.font(.caption)
.padding(5)
.background(
Circle()
.foregroundStyle(.gray)
.opacity(0.2)
)
.padding(-5)
}
}
}
}

#Preview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,33 @@

import SwiftUI

extension View {
@ViewBuilder
func dropdownItemStyle() -> some View {
self.modifier(DropdownMenuItemStyleModifier())
}
}

struct DropdownMenuItemStyleModifier: ViewModifier {
@State private var isHovering = false

func body(content: Content) -> some View {
content
.padding(.vertical, 4)
.padding(.horizontal, 8)
.background(
isHovering
? AnyView(EffectView(.selection, blendingMode: .withinWindow, emphasized: true))
: AnyView(Color.clear)
)
.foregroundColor(isHovering ? Color(NSColor.white) : .primary)
.if(.tahoe) {
if #available(macOS 26, *) {
$0.clipShape(ContainerRelativeShape())
}
} else: {
$0.clipShape(RoundedRectangle(cornerRadius: 5))
}
.onHover(perform: { hovering in
self.isHovering = hovering
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ struct OptionMenuItemView: View {
Text(label)
Spacer()
}
.padding(.vertical, 4)
.padding(.horizontal, 28)
.modifier(DropdownMenuItemStyleModifier())
.clipShape(RoundedRectangle(cornerRadius: 5))
.padding(.horizontal, 20)
.dropdownItemStyle()
.onTapGesture {
action()
}
Expand Down
Loading
Loading