From 89538faffa335dd8f37e4147102dc33e075bc7be Mon Sep 17 00:00:00 2001 From: Hariharan Mudaliar Date: Sat, 22 Nov 2025 13:16:16 +0530 Subject: [PATCH] Removed BoringWorkerNotifier Dependency --- DynamicIsland.xcodeproj/project.pbxproj | 17 ----- .../xcshareddata/WorkspaceSettings.xcsettings | 5 ++ .../xcshareddata/swiftpm/Package.resolved | 11 +--- DynamicIsland/DynamicIslandApp.swift | 6 +- .../DynamicIslandViewCoordinator.swift | 65 +------------------ DynamicIsland/Localizable.xcstrings | 8 +++ .../Shortcuts/ShortcutConstants.swift | 1 - .../components/DynamicIslandSystemTiles.swift | 44 +++++-------- .../models/DynamicIslandViewModel.swift | 1 - 9 files changed, 35 insertions(+), 123 deletions(-) create mode 100644 DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/DynamicIsland.xcodeproj/project.pbxproj b/DynamicIsland.xcodeproj/project.pbxproj index 087636a..8e52725 100644 --- a/DynamicIsland.xcodeproj/project.pbxproj +++ b/DynamicIsland.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ 7E6118152E24071E0050006C /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 14D0321C2C68F3350096E6A1 /* Sparkle */; }; 7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = B18654382C6F4990000B926A /* KeyboardShortcuts */; }; 7E6118172E24071E0050006C /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = 9A987A0F2C73CA8D005CA465 /* Collections */; }; - 7E6118182E24071E0050006C /* TheBoringWorkerNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 1485442E2C8F049C00943381 /* TheBoringWorkerNotifier */; }; 7E6118192E24071E0050006C /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = B19016212CC15B3D00E3F12E /* Defaults */; }; 7E61181A2E24071E0050006C /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */; }; 7E61181B2E24071E0050006C /* LottieUI in Frameworks */ = {isa = PBXBuildFile; productRef = B194240A2CD10017003E5DC2 /* LottieUI */; }; @@ -86,7 +85,6 @@ 7E25ECA32E6C6E2600700E72 /* OSD.framework in Frameworks */, 7E25ECA52E6C6E7800700E72 /* DisplayServices.framework in Frameworks */, 7E6118192E24071E0050006C /* Defaults in Frameworks */, - 7E6118182E24071E0050006C /* TheBoringWorkerNotifier in Frameworks */, 7E6118172E24071E0050006C /* Collections in Frameworks */, 7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */, 7E6118152E24071E0050006C /* Sparkle in Frameworks */, @@ -174,7 +172,6 @@ 14D0321C2C68F3350096E6A1 /* Sparkle */, B18654382C6F4990000B926A /* KeyboardShortcuts */, 9A987A0F2C73CA8D005CA465 /* Collections */, - 1485442E2C8F049C00943381 /* TheBoringWorkerNotifier */, B19016212CC15B3D00E3F12E /* Defaults */, B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */, B194240A2CD10017003E5DC2 /* LottieUI */, @@ -215,7 +212,6 @@ 14D0321B2C68F3350096E6A1 /* XCRemoteSwiftPackageReference "Sparkle" */, B18654372C6F4990000B926A /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */, 9A987A112C73CAA1005CA465 /* XCRemoteSwiftPackageReference "Pow" */, - 1485442D2C8F049C00943381 /* XCRemoteSwiftPackageReference "TheBoringWorkerNotifier" */, B19016202CC15B3D00E3F12E /* XCRemoteSwiftPackageReference "Defaults" */, B1628B902CC260C0003D8DF3 /* XCRemoteSwiftPackageReference "swiftui-introspect" */, B19424072CD0DB52003E5DC2 /* XCRemoteSwiftPackageReference "LottieUI" */, @@ -546,14 +542,6 @@ minimumVersion = 0.1.0; }; }; - 1485442D2C8F049C00943381 /* XCRemoteSwiftPackageReference "TheBoringWorkerNotifier" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/TheBoredTeam/TheBoringWorkerNotifier.git"; - requirement = { - branch = main; - kind = branch; - }; - }; 14D032182C68F32E0096E6A1 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin-Modern"; @@ -642,11 +630,6 @@ package = 146BC4352D366E9B0047C66A /* XCRemoteSwiftPackageReference "MacroVisionKit" */; productName = MacroVisionKit; }; - 1485442E2C8F049C00943381 /* TheBoringWorkerNotifier */ = { - isa = XCSwiftPackageProductDependency; - package = 1485442D2C8F049C00943381 /* XCRemoteSwiftPackageReference "TheBoringWorkerNotifier" */; - productName = TheBoringWorkerNotifier; - }; 14D032192C68F32E0096E6A1 /* LaunchAtLogin */ = { isa = XCSwiftPackageProductDependency; package = 14D032182C68F32E0096E6A1 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */; diff --git a/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 740c142..e251005 100644 --- a/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DynamicIsland.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ac662b7c30c44a46342d90fd2f894c1a70161e39d60b85657ca39c859e894c44", + "originHash" : "3b2c9100f16643012ece44ae6bfed9555c2d858d8ac2f98547c70e4c1738f0f6", "pins" : [ { "identity" : "defaults", @@ -117,15 +117,6 @@ "revision" : "807f73ce09a9b9723f12385e592b4e0aaebd3336", "version" : "1.3.0" } - }, - { - "identity" : "theboringworkernotifier", - "kind" : "remoteSourceControl", - "location" : "https://github.com/TheBoredTeam/TheBoringWorkerNotifier.git", - "state" : { - "branch" : "main", - "revision" : "bc2b292c88035dcfc41fc7e3d8021689e624d137" - } } ], "version" : 3 diff --git a/DynamicIsland/DynamicIslandApp.swift b/DynamicIsland/DynamicIslandApp.swift index 7d3e437..04417c5 100644 --- a/DynamicIsland/DynamicIslandApp.swift +++ b/DynamicIsland/DynamicIslandApp.swift @@ -354,10 +354,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { } func applicationDidFinishLaunching(_ notification: Notification) { - - coordinator.setupWorkersNotificationObservers() - LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm) - LockScreenManager.shared.configure(viewModel: vm) + LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm) + LockScreenManager.shared.configure(viewModel: vm) // Migrate legacy progress bar settings Defaults.Keys.migrateProgressBarStyle() diff --git a/DynamicIsland/DynamicIslandViewCoordinator.swift b/DynamicIsland/DynamicIslandViewCoordinator.swift index febe004..d2ed741 100644 --- a/DynamicIsland/DynamicIslandViewCoordinator.swift +++ b/DynamicIsland/DynamicIslandViewCoordinator.swift @@ -8,7 +8,6 @@ import Combine import Defaults import SwiftUI -import TheBoringWorkerNotifier enum SneakContentType { case brightness @@ -34,13 +33,6 @@ struct sneakPeek { var icon: String = "" } -struct SharedSneakPeek: Codable { - var show: Bool - var type: String - var value: String - var icon: String -} - enum BrowserType { case chromium case safari @@ -55,7 +47,6 @@ struct ExpandedItem { class DynamicIslandViewCoordinator: ObservableObject { static let shared = DynamicIslandViewCoordinator() - var notifier: TheBoringWorkerNotifier @Published var currentView: NotchViews = .home @@ -64,7 +55,6 @@ class DynamicIslandViewCoordinator: ObservableObject { @AppStorage("showWhatsNew") var showWhatsNew: Bool = true @AppStorage("musicLiveActivityEnabled") var musicLiveActivityEnabled: Bool = true @AppStorage("timerLiveActivityEnabled") var timerLiveActivityEnabled: Bool = true - @AppStorage("currentMicStatus") var currentMicStatus: Bool = true @AppStorage("alwaysShowTabs") var alwaysShowTabs: Bool = true { didSet { @@ -85,11 +75,7 @@ class DynamicIslandViewCoordinator: ObservableObject { } } - @AppStorage("hudReplacement") var hudReplacement: Bool = true { - didSet { - notifier.postNotification(name: notifier.toggleHudReplacementNotification.name, userInfo: nil) - } - } + @AppStorage("hudReplacement") var hudReplacement: Bool = true @AppStorage("preferred_screen_name") var preferredScreen = NSScreen.main?.localizedName ?? "Unknown" { didSet { @@ -103,46 +89,9 @@ class DynamicIslandViewCoordinator: ObservableObject { @Published var optionKeyPressed: Bool = true private init() { - notifier = TheBoringWorkerNotifier() selectedScreen = preferredScreen } - func setupWorkersNotificationObservers() { - notifier.setupObserver(notification: notifier.micStatusNotification, handler: initialMicStatus) - notifier.setupObserver(notification: notifier.sneakPeakNotification, handler: sneakPeekEvent) - } - - @objc func sneakPeekEvent(_ notification: Notification) { - let decoder = JSONDecoder() - if let decodedData = try? decoder.decode( - SharedSneakPeek.self, from: notification.userInfo?.first?.value as! Data) - { - let contentType = - decodedData.type == "brightness" - ? SneakContentType.brightness - : decodedData.type == "volume" - ? SneakContentType.volume - : decodedData.type == "backlight" - ? SneakContentType.backlight - : decodedData.type == "mic" - ? SneakContentType.mic - : decodedData.type == "timer" - ? SneakContentType.timer : SneakContentType.brightness - - let formatter = NumberFormatter() - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.numberStyle = .decimal - let value = CGFloat((formatter.number(from: decodedData.value) ?? 0.0).floatValue) - let icon = decodedData.icon - - print("Decoded: \(decodedData), Parsed value: \(value)") - - toggleSneakPeek(status: decodedData.show, type: contentType, value: value, icon: icon) - } else { - print("Failed to decode JSON data") - } - } - func toggleSneakPeek(status: Bool, type: SneakContentType, duration: TimeInterval = 1.5, value: CGFloat = 0, icon: String = "") { let resolvedDuration: TimeInterval switch type { @@ -168,10 +117,6 @@ class DynamicIslandViewCoordinator: ObservableObject { self.sneakPeek.icon = icon } } - - if type == .mic { - currentMicStatus = value == 1 - } } private var sneakPeekDuration: TimeInterval = 1.5 @@ -239,14 +184,6 @@ class DynamicIslandViewCoordinator: ObservableObject { } - @objc func initialMicStatus(_ notification: Notification) { - currentMicStatus = notification.userInfo?.first?.value as! Bool - } - - func toggleMic() { - notifier.postNotification(name: notifier.toggleMicNotification.name, userInfo: nil) - } - func showEmpty() { currentView = .home } diff --git a/DynamicIsland/Localizable.xcstrings b/DynamicIsland/Localizable.xcstrings index b757544..6c34855 100644 --- a/DynamicIsland/Localizable.xcstrings +++ b/DynamicIsland/Localizable.xcstrings @@ -11032,6 +11032,10 @@ } } }, + "Manage indicator preferences from Settings → Privacy. No manual microphone toggle is required." : { + "comment" : "A description of how to manage the microphone privacy indicator preferences.", + "isCommentAutoGenerated" : true + }, "Manage the Clock timer from the Clock app." : { }, @@ -12284,6 +12288,10 @@ } } }, + "Microphone privacy indicator runs automatically whenever apps access audio." : { + "comment" : "A description of the microphone privacy indicator feature.", + "isCommentAutoGenerated" : true + }, "Microphone Status" : { "localizations" : { "fr" : { diff --git a/DynamicIsland/Shortcuts/ShortcutConstants.swift b/DynamicIsland/Shortcuts/ShortcutConstants.swift index e6d276f..12d554f 100644 --- a/DynamicIsland/Shortcuts/ShortcutConstants.swift +++ b/DynamicIsland/Shortcuts/ShortcutConstants.swift @@ -12,7 +12,6 @@ extension KeyboardShortcuts.Name { static let clipboardHistoryPanel = Self("clipboardHistoryPanel", default: .init(.c, modifiers: [.shift, .command])) static let colorPickerPanel = Self("colorPickerPanel", default: .init(.p, modifiers: [.shift, .command])) static let screenAssistantPanel = Self("screenAssistantPanel", default: .init(.a, modifiers: [.shift, .command])) - static let toggleMicrophone = Self("toggleMicrophone", default: .init(.f5, modifiers: [.function])) static let decreaseBacklight = Self("decreaseBacklight", default: .init(.f1, modifiers: [.command])) static let increaseBacklight = Self("increaseBacklight", default: .init(.f2, modifiers: [.command])) static let toggleSneakPeek = Self("toggleSneakPeek", default: .init(.h, modifiers: [.command, .shift])) diff --git a/DynamicIsland/components/DynamicIslandSystemTiles.swift b/DynamicIsland/components/DynamicIslandSystemTiles.swift index 20cea65..8302ab5 100644 --- a/DynamicIsland/components/DynamicIslandSystemTiles.swift +++ b/DynamicIsland/components/DynamicIslandSystemTiles.swift @@ -72,35 +72,27 @@ func logout() { } struct DynamicIslandSystemTiles: View { - @EnvironmentObject var vm: DynamicIslandViewModel - @ObservedObject var coordinator = DynamicIslandViewCoordinator.shared - - struct ItemButton { - var icon: String - var onTap: () -> Void - } - var body: some View { - Grid { - GridRow { -// SystemItemButton(icon: "clipboard", onTap: { -// vm.openClipboard() -// }, label: "Clipboard History", showEmojis: Defaults[.showEmojis], emoji: "✨") - // SystemItemButton(icon: "keyboard", onTap: { - // vm?.close() - // vm?.togglesneakPeek(status: true, type: .backlight, value: 1) - // }, label: "💡 Keyboard Backlight") - } - GridRow { - SystemItemButton(icon: coordinator.currentMicStatus ? "mic" : "mic.slash", onTap: { - coordinator.toggleMic() - vm.close() - }, label: "Toggle Microphone", showEmojis: Defaults[.showEmojis], emoji: coordinator.currentMicStatus ? "😀" : "🤫") - // SystemItemButton(icon: "lock", onTap: { - // logout() - // }, label: "🔒 Lock My Device") + VStack(alignment: .leading, spacing: 6) { + Label { + Text("Microphone privacy indicator runs automatically whenever apps access audio.") + .font(.caption) + .foregroundStyle(.gray) + .lineLimit(3) + .multilineTextAlignment(.leading) + } icon: { + Image(systemName: "shield.lefthalf.filled") + .foregroundStyle(.gray) } + + Text("Manage indicator preferences from Settings → Privacy. No manual microphone toggle is required.") + .font(.caption2) + .foregroundStyle(.secondary) + .lineLimit(3) + .multilineTextAlignment(.leading) } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.vertical, 4) } } diff --git a/DynamicIsland/models/DynamicIslandViewModel.swift b/DynamicIsland/models/DynamicIslandViewModel.swift index cbfc80c..8e79803 100644 --- a/DynamicIsland/models/DynamicIslandViewModel.swift +++ b/DynamicIsland/models/DynamicIslandViewModel.swift @@ -8,7 +8,6 @@ import Combine import Defaults import SwiftUI -import TheBoringWorkerNotifier class DynamicIslandViewModel: NSObject, ObservableObject { @ObservedObject var coordinator = DynamicIslandViewCoordinator.shared