Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Tell VoiceOver what the Reset sheet found when its scan ends

Țugui Dragoșb29d1af23c7b
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ScanAnnouncementTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ScanAnnouncementTests.swift
new file mode 100644
index 00000000..de46995e
--- /dev/null
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ScanAnnouncementTests.swift
@@ -0,0 +1,23 @@
+import Foundation
+import Testing
+
+struct ScanAnnouncementTests {
+ @Test func everyViewAnnouncesItsScanOutsideWhatScanStateBuildsAgain() throws {
+ let root = LineLengthTests.repository.path(percentEncoded: false)
+ var found: [String] = []
+ for file in try LineLengthTests.swiftFiles()
+ where file.path(percentEncoded: false).dropFirst(root.count).hasPrefix("Peel/") {
+ let text = try String(contentsOf: file, encoding: .utf8)
+ guard let announcement = text.range(of: ".announcesScan("), let state = text.range(of: ".scanState(") else {
+ continue
+ }
+ if announcement.lowerBound < state.lowerBound {
+ found.append(String(file.path(percentEncoded: false).dropFirst(root.count)))
+ }
+ }
+ #expect(
+ found.isEmpty,
+ "ScanState builds its content again when the first scan ends, which loses an announcement inside it: \(found)"
+ )
+ }
+}
diff --git a/Peel/Views/ResetSheet.swift b/Peel/Views/ResetSheet.swift
index 755c1824..f99e1d5f 100644
--- a/Peel/Views/ResetSheet.swift
+++ b/Peel/Views/ResetSheet.swift
@@ -184,12 +184,6 @@ struct ResetSheet: View {
}
}
.scrollBarBelowSectionHeaders()
- .announcesScan(
- plan.scanRun.isRunning,
- found: plan.items.isEmpty ? nil : AttributedString(localized: "^[\(plan.items.count) item](inflect: true)."),
- couldNotLook: phase != .message ? nil : plan.isExcluded ? "This app is excluded" : "Nothing to Reset",
- wasStopped: plan.scanRun.wasStopped
- )
.scanState(phase, scan: plan.scanRun) {
if plan.isExcluded {
ContentUnavailableView(
@@ -205,6 +199,12 @@ struct ResetSheet: View {
)
}
}
+ .announcesScan(
+ plan.scanRun.isRunning,
+ found: plan.items.isEmpty ? nil : AttributedString(localized: "^[\(plan.items.count) item](inflect: true)."),
+ couldNotLook: phase != .message ? nil : plan.isExcluded ? "This app is excluded" : "Nothing to Reset",
+ wasStopped: plan.scanRun.wasStopped
+ )
.edgeBar(.bottom) { bar }
}