Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Tell VoiceOver what Turn All Off did and what macOS refused
Țugui Dragoș21e33d016a57
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 719b60df..150fe9c8 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -151355,6 +151355,346 @@}}},+ "Put back ^[%lld setting](inflect: true)." : {+ "localizations" : {+ "cs" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vrácena zpět %lld nastavení."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vráceno zpět %lld nastavení."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vráceno zpět %lld nastavení."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vráceno zpět %lld nastavení."+ }+ }+ }+ }+ },+ "de" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld Einstellung zurückgelegt."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld Einstellungen zurückgelegt."+ }+ }+ }+ }+ },+ "es" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Se han restaurado %lld de ajustes."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Se ha restaurado un ajuste."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Se han restaurado %lld ajustes."+ }+ }+ }+ }+ },+ "fr" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld de réglages remis en place."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld réglage remis en place."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld réglages remis en place."+ }+ }+ }+ }+ },+ "it" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ripristinate %lld di impostazioni."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ripristinata %lld impostazione."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ripristinate %lld impostazioni."+ }+ }+ }+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld件の設定を元に戻しました。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "설정 %lld개를 되돌려 놓았습니다."+ }+ },+ "nl" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld instelling teruggezet."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld instellingen teruggezet."+ }+ }+ }+ }+ },+ "pl" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Przywrócono %lld ustawienia."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Przywrócono %lld ustawień."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Przywrócono %lld ustawienie."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Przywrócono %lld ustawienia."+ }+ }+ }+ }+ },+ "pt" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld de ajustes colocados de volta."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld ajuste colocado de volta."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld ajustes colocados de volta."+ }+ }+ }+ }+ },+ "ro" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld configurări au fost puse înapoi."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld configurare a fost pusă înapoi."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld de configurări au fost puse înapoi."+ }+ }+ }+ }+ },+ "ru" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Восстановлено %lld параметра."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Восстановлено %lld параметров."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Восстановлен %lld параметр."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Восстановлено %lld параметра."+ }+ }+ }+ }+ },+ "sv" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld inställning återställdes."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld inställningar återställdes."+ }+ }+ }+ }+ },+ "tr" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld ayar geri getirildi."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld ayar geri getirildi."+ }+ }+ }+ }+ },+ "uk" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Повернуто назад %lld налаштування."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Повернуто назад %lld налаштувань."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Повернуто назад %lld налаштування."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Повернуто назад %lld налаштування."+ }+ }+ }+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已将%lld项设置放回原处。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已將%lld項設定還原。"+ }+ }+ }+ },"Put back the ^[%lld setting](inflect: true) Peel changed?" : {"localizations" : {"cs" : {@@ -251092,6 +251432,346 @@}}},+ "macOS refused ^[%lld setting](inflect: true)." : {+ "localizations" : {+ "cs" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS odmítl %lld nastavení."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS odmítl %lld nastavení."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS odmítl %lld nastavení."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS odmítl %lld nastavení."+ }+ }+ }+ }+ },+ "de" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS hat %lld Einstellung abgelehnt."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS hat %lld Einstellungen abgelehnt."+ }+ }+ }+ }+ },+ "es" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rechazado %lld de ajustes."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rechazado un ajuste."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rechazado %lld ajustes."+ }+ }+ }+ }+ },+ "fr" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refusé %lld de réglages."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refusé %lld réglage."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refusé %lld réglages."+ }+ }+ }+ }+ },+ "it" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rifiutato %lld di impostazioni."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rifiutato %lld impostazione."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rifiutato %lld impostazioni."+ }+ }+ }+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld件の設定がmacOSに拒否されました。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS가 설정 %lld개를 거부했습니다."+ }+ },+ "nl" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS heeft %lld instelling geweigerd."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS heeft %lld instellingen geweigerd."+ }+ }+ }+ }+ },+ "pl" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS odmówił zmiany %lld ustawień."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS odmówił zmiany %lld ustawień."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS odmówił zmiany %lld ustawienia."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS odmówił zmiany %lld ustawienia."+ }+ }+ }+ }+ },+ "pt" : {+ "variations" : {+ "plural" : {+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O macOS recusou %lld de ajustes."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O macOS recusou %lld ajuste."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O macOS recusou %lld ajustes."+ }+ }+ }+ }+ },+ "ro" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refuzat %lld configurări."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refuzat %lld configurare."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refuzat %lld de configurări."+ }+ }+ }+ }+ },+ "ru" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS отклонила %lld параметра."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS отклонила %lld параметров."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS отклонила %lld параметр."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS отклонила %lld параметра."+ }+ }+ }+ }+ },+ "sv" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS nekade %lld inställning."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS nekade %lld inställningar."+ }+ }+ }+ }+ },+ "tr" : {+ "variations" : {+ "plural" : {+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS, %lld ayarı reddetti."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS, %lld ayarı reddetti."+ }+ }+ }+ }+ },+ "uk" : {+ "variations" : {+ "plural" : {+ "few" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS не прийняла %lld налаштування."+ }+ },+ "many" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS не прийняла %lld налаштувань."+ }+ },+ "one" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS не прийняла %lld налаштування."+ }+ },+ "other" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS не прийняла %lld налаштування."+ }+ }+ }+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS拒绝了%lld项设置更改。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS拒絕了%lld項設定。"+ }+ }+ }+ },"macOS refused it" : {"localizations" : {"cs" : {@@ -251198,6 +251878,112 @@}}},+ "macOS refused the change to %@." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Systém macOS odmítl změnu nastavení „%@“."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS hat die Änderung an „%@“ abgelehnt."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rechazado el cambio en %@."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refusé la modification de « %@ »."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS ha rifiutato la modifica di “%@”."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“%@”の変更がmacOSに拒否されました。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS가 ‘%@’ 변경을 거부했습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS heeft de wijziging van '%@' geweigerd."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS odmówił zmiany ustawienia: %@."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O macOS recusou a alteração de %@."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS a refuzat modificarea configurării %@."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS отклонила изменение параметра «%@»."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS nekade ändringen av %@."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS şu ayardaki değişikliği reddetti: %@."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS не прийняла зміну налаштування «%@»."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS拒绝了对“%@”的更改。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "macOS拒絕了對「%@」的變更。"+ }+ }+ }+ },"macOS remembers what an app was allowed to access, such as the camera or the microphone, and keeps that after the app is gone. If this is selected, Peel clears it just before the app goes to the Trash, the last moment macOS can still find the app, so the app asks you again if you install it later. This happens only if the app itself is selected." : {"localizations" : {"cs" : {diff --git a/Peel/Model/TweakLibrary.swift b/Peel/Model/TweakLibrary.swiftindex 57a9b5f7..6a33bf58 100644--- a/Peel/Model/TweakLibrary.swift+++ b/Peel/Model/TweakLibrary.swift@@ -1,3 +1,4 @@+import Accessibilityimport Foundationimport Observationimport PeelCore@@ -22,6 +23,7 @@ final class TweakLibrary {private let defaults: UserDefaultsprivate let home: URLprivate let restart: @Sendable (Tweak.Restart) async -> Void+ private let announcing: (AttributedString) -> Void/// What Peel changed, and the values from before. `TweakLedger` decides what turning a switch on or off/// does, and is tested there.private var ledger: TweakLedger@@ -35,9 +37,11 @@ final class TweakLibrary {store: any TweakStoring = TweakStore(),defaults: UserDefaults = .standard,home: URL = .homeDirectory,- restart: @escaping @Sendable (Tweak.Restart) async -> Void = TweakRestart.run+ restart: @escaping @Sendable (Tweak.Restart) async -> Void = TweakRestart.run,+ announcing: @escaping (AttributedString) -> Void = { AccessibilityNotification.Announcement($0).post() }) {self.store = store+ self.announcing = announcingself.defaults = defaultsself.home = homeself.restart = restart@@ -198,6 +202,23 @@ final class TweakLibrary {await restart(needed)}refresh()+ announcing(+ Self.spoken(puttingBack: batch.changed.count, refused: batch.refused.count, restarts: batch.restarts)+ )+ }++ /// What VoiceOver hears once Turn All Off has ended, since the bar's words change without a sound.+ private static func spoken(puttingBack: Int, refused: Int, restarts: [Tweak.Restart]) -> AttributedString {+ var words = AttributedString(localized: "Put back ^[\(puttingBack) setting](inflect: true).")+ if refused > 0 {+ words += AttributedString(" ")+ words += AttributedString(localized: "macOS refused ^[\(refused) setting](inflect: true).")+ }+ for sentence in restarts.compactMap(\.sentence) {+ words += AttributedString(" ")+ words += AttributedString(localized: sentence)+ }+ return words}/// Saves the result of a change and restarts what the tweak needs. Nothing restarts when the setting was@@ -206,6 +227,7 @@ final class TweakLibrary {defer { if isLast { asked[tweak.id] = nil } }if outcome == .refused { refused.insert(tweak.id) } else { refused.remove(tweak.id) }guard outcome != .refused else {+ announcing(AttributedString(localized: "macOS refused the change to \(String(localized: tweak.words.title))."))if isLast, restartOwed.remove(tweak.id) != nil { await restart(tweak.restart) }refresh()returndiff --git a/PeelTests/TweakLibraryTests.swift b/PeelTests/TweakLibraryTests.swiftindex fb509d29..dfdb3744 100644--- a/PeelTests/TweakLibraryTests.swift+++ b/PeelTests/TweakLibraryTests.swift@@ -58,6 +58,10 @@ struct TweakLibraryTests {var asked: [Tweak.Restart] = []}+ private final class Said {+ var lines: [String] = []+ }+private func makeLibrary(store: FakeTweakStore, restarts: Restarts = Restarts()) throws -> (TweakLibrary, MadeUpDefaults) {@@ -160,6 +164,42 @@ struct TweakLibraryTests {#expect(!reopened.isChangedByPeel(tweak))}+ @Test func tellsVoiceOverWhatTurnAllOffDid() async throws {+ let store = FakeTweakStore()+ let quiet = try #require(Self.quiet.first { if case .aSwitch = $0.kind { true } else { false } })+ let said = Said()+ let made = try MadeUpDefaults()+ defer { made.forget() }+ let library = TweakLibrary(+ store: store, defaults: made.defaults, restart: { _ in },+ announcing: { said.lines.append(String($0.characters)) }+ )+ await library.turnOn(quiet)++ await library.turnAllOff()++ let words = AttributedString(localized: "Put back ^[\(1) setting](inflect: true).")+ #expect(said.lines.last == String(words.characters))+ }++ @Test func tellsVoiceOverWhichChangeMacOSRefused() async throws {+ let store = FakeTweakStore()+ let quiet = try #require(Self.quiet.first { if case .aSwitch = $0.kind { true } else { false } })+ store.refuses = [quiet.id]+ let said = Said()+ let made = try MadeUpDefaults()+ defer { made.forget() }+ let library = TweakLibrary(+ store: store, defaults: made.defaults, restart: { _ in },+ announcing: { said.lines.append(String($0.characters)) }+ )++ await library.set(quiet, on: true).value++ let title = String(localized: quiet.words.title)+ #expect(said.lines == [String(localized: "macOS refused the change to \(title).")])+ }+@Test func twoRefusedSwitchesBothSaySo() async throws {let store = FakeTweakStore()let (library, made) = try makeLibrary(store: store)