Skip to content

Commit 29990f4

Browse files
committed
Added Activities section to the Internal Developer Inspector for testing purposes.
1 parent 03d2018 commit 29990f4

File tree

5 files changed

+85
-2
lines changed

5 files changed

+85
-2
lines changed

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@
530530
B616EA8D2D65238900DF9029 /* InternalDevelopmentInspectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B616EA8B2D65238900DF9029 /* InternalDevelopmentInspectorView.swift */; };
531531
B616EA8F2D662E9800DF9029 /* InternalDevelopmentNotificationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B616EA8E2D662E9800DF9029 /* InternalDevelopmentNotificationsView.swift */; };
532532
B616EA942D67C4DA00DF9029 /* CEActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = B616EA932D67C4DA00DF9029 /* CEActivity.swift */; };
533+
B616EA962D67E20A00DF9029 /* InternalDevelopmentActivitiesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B616EA952D67E20A00DF9029 /* InternalDevelopmentActivitiesView.swift */; };
533534
B61A606129F188AB009B43F9 /* ExternalLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = B61A606029F188AB009B43F9 /* ExternalLink.swift */; };
534535
B61A606929F4481A009B43F9 /* MonospacedFontPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = B61A606829F4481A009B43F9 /* MonospacedFontPicker.swift */; };
535536
B61DA9DF29D929E100BF4A43 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B61DA9DE29D929E100BF4A43 /* GeneralSettingsView.swift */; };
@@ -1226,6 +1227,7 @@
12261227
B616EA8B2D65238900DF9029 /* InternalDevelopmentInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalDevelopmentInspectorView.swift; sourceTree = "<group>"; };
12271228
B616EA8E2D662E9800DF9029 /* InternalDevelopmentNotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalDevelopmentNotificationsView.swift; sourceTree = "<group>"; };
12281229
B616EA932D67C4DA00DF9029 /* CEActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CEActivity.swift; sourceTree = "<group>"; };
1230+
B616EA952D67E20A00DF9029 /* InternalDevelopmentActivitiesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalDevelopmentActivitiesView.swift; sourceTree = "<group>"; };
12291231
B61A606029F188AB009B43F9 /* ExternalLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLink.swift; sourceTree = "<group>"; };
12301232
B61A606829F4481A009B43F9 /* MonospacedFontPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonospacedFontPicker.swift; sourceTree = "<group>"; };
12311233
B61DA9DE29D929E100BF4A43 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
@@ -3272,6 +3274,7 @@
32723274
children = (
32733275
B616EA8B2D65238900DF9029 /* InternalDevelopmentInspectorView.swift */,
32743276
B616EA8E2D662E9800DF9029 /* InternalDevelopmentNotificationsView.swift */,
3277+
B616EA952D67E20A00DF9029 /* InternalDevelopmentActivitiesView.swift */,
32753278
);
32763279
path = InternalDevelopmentInspector;
32773280
sourceTree = "<group>";
@@ -4435,6 +4438,7 @@
44354438
B66A4E5329C91831004573B4 /* CodeEditCommands.swift in Sources */,
44364439
58822529292C280D00E83CDE /* StatusBarLineEndSelector.swift in Sources */,
44374440
5C4BB1E128212B1E00A92FB2 /* World.swift in Sources */,
4441+
B616EA962D67E20A00DF9029 /* InternalDevelopmentActivitiesView.swift in Sources */,
44384442
581550D029FBD30400684881 /* FileSystemTableViewCell.swift in Sources */,
44394443
B607183F2B17DB07009CDAB4 /* SourceControlNavigatorRepositoryView+contextMenu.swift in Sources */,
44404444
B62AEDD42A27B29F009A9F52 /* PaneToolbar.swift in Sources */,

CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ final class CodeEditSplitViewController: NSSplitViewController {
8888
InspectorAreaView(viewModel: InspectorAreaViewModel())
8989
.environmentObject(workspace)
9090
.environmentObject(editorManager)
91+
.environmentObject(workspace.activityManager)
9192
})
9293

9394
addSplitViewItem(inspector)
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
//
2+
// InternalDevelopmentActivitiesView.swift
3+
// CodeEdit
4+
//
5+
// Created by Austin Condiff on 2/20/25.
6+
//
7+
8+
import SwiftUI
9+
10+
struct InternalDevelopmentActivitiesView: View {
11+
@EnvironmentObject var activityManager: ActivityManager
12+
13+
@State private var activityTitle: String = "Test Activity"
14+
@State private var activityMessage: String = "This is a test activity."
15+
@State private var activityProgress: Double = 0.0
16+
@State private var isLoading: Bool = false
17+
@State private var isPriority: Bool = false
18+
@State private var autoDelete: Bool = false
19+
@State private var deleteDelay: Double = 3.0
20+
21+
var body: some View {
22+
Section("Activities") {
23+
Toggle("Priority", isOn: $isPriority)
24+
Toggle("Loading", isOn: $isLoading)
25+
26+
TextField("Title", text: $activityTitle)
27+
TextField("Message", text: $activityMessage, axis: .vertical)
28+
.lineLimit(1...5)
29+
30+
if !isLoading {
31+
HStack {
32+
Text("Progress")
33+
Slider(value: $activityProgress, in: 0...1)
34+
Text("\(Int(activityProgress * 100))%")
35+
.monospacedDigit()
36+
.frame(width: 40, alignment: .trailing)
37+
}
38+
}
39+
40+
Toggle("Auto Delete", isOn: $autoDelete)
41+
42+
if autoDelete {
43+
HStack {
44+
Text("Delete After")
45+
Slider(value: $deleteDelay, in: 1...10)
46+
Text("\(Int(deleteDelay))s")
47+
.monospacedDigit()
48+
.frame(width: 30, alignment: .trailing)
49+
}
50+
}
51+
52+
Button("Add Activity") {
53+
let activity = activityManager.post(
54+
priority: isPriority,
55+
title: activityTitle,
56+
message: activityMessage,
57+
percentage: isLoading ? nil : activityProgress,
58+
isLoading: isLoading
59+
)
60+
61+
if autoDelete {
62+
activityManager.delete(id: activity.id, delay: deleteDelay)
63+
}
64+
}
65+
66+
if !activityManager.activities.isEmpty {
67+
Button("Clear All Activities") {
68+
for activity in activityManager.activities {
69+
activityManager.delete(id: activity.id)
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}

CodeEdit/Features/InspectorArea/InternalDevelopmentInspector/InternalDevelopmentInspectorView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
// InternalDevelopmentInspectorView.swift
33
// CodeEdit
44
//
5-
// Created by Austin Condiff on 2/19/24.
5+
// Created by Austin Condiff on 2/19/25.
66
//
77

88
import SwiftUI
99

1010
struct InternalDevelopmentInspectorView: View {
11+
@EnvironmentObject var activityManager: ActivityManager
12+
1113
var body: some View {
1214
Form {
15+
InternalDevelopmentActivitiesView()
1316
InternalDevelopmentNotificationsView()
1417
}
1518
}

CodeEdit/Features/InspectorArea/InternalDevelopmentInspector/InternalDevelopmentNotificationsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// InternalDevelopmentNotificationsView.swift
33
// CodeEdit
44
//
5-
// Created by Austin Condiff on 2/19/24.
5+
// Created by Austin Condiff on 2/19/25.
66
//
77

88
import SwiftUI

0 commit comments

Comments
 (0)