Merge branch 'main' into feature/media

Looks like we are trying to merge main into the thing that we are trying to do, hope it works
This commit is contained in:
Hariharan Mudaliar 2025-11-22 22:12:26 +05:30
commit b1289560a7
9 changed files with 31 additions and 124 deletions

2
.gitignore vendored
View file

@ -15,7 +15,7 @@ buildServer.json
*.xctest *.xctest
*.xcuserdata *.xcuserdata
*.xcodeproj/xcshareddata/WorkspaceSettings.xcsettings *.xcodeproj/xcshareddata/WorkspaceSettings.xcsettings
*.xcsettings
# CocoaPods # CocoaPods
Pods/ Pods/
podfile.lock podfile.lock

View file

@ -15,7 +15,6 @@
7E6118152E24071E0050006C /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 14D0321C2C68F3350096E6A1 /* Sparkle */; }; 7E6118152E24071E0050006C /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 14D0321C2C68F3350096E6A1 /* Sparkle */; };
7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = B18654382C6F4990000B926A /* KeyboardShortcuts */; }; 7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = B18654382C6F4990000B926A /* KeyboardShortcuts */; };
7E6118172E24071E0050006C /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = 9A987A0F2C73CA8D005CA465 /* Collections */; }; 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 */; }; 7E6118192E24071E0050006C /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = B19016212CC15B3D00E3F12E /* Defaults */; };
7E61181A2E24071E0050006C /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */; }; 7E61181A2E24071E0050006C /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */; };
7E61181B2E24071E0050006C /* LottieUI in Frameworks */ = {isa = PBXBuildFile; productRef = B194240A2CD10017003E5DC2 /* LottieUI */; }; 7E61181B2E24071E0050006C /* LottieUI in Frameworks */ = {isa = PBXBuildFile; productRef = B194240A2CD10017003E5DC2 /* LottieUI */; };
@ -86,7 +85,6 @@
7E25ECA32E6C6E2600700E72 /* OSD.framework in Frameworks */, 7E25ECA32E6C6E2600700E72 /* OSD.framework in Frameworks */,
7E25ECA52E6C6E7800700E72 /* DisplayServices.framework in Frameworks */, 7E25ECA52E6C6E7800700E72 /* DisplayServices.framework in Frameworks */,
7E6118192E24071E0050006C /* Defaults in Frameworks */, 7E6118192E24071E0050006C /* Defaults in Frameworks */,
7E6118182E24071E0050006C /* TheBoringWorkerNotifier in Frameworks */,
7E6118172E24071E0050006C /* Collections in Frameworks */, 7E6118172E24071E0050006C /* Collections in Frameworks */,
7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */, 7E6118162E24071E0050006C /* KeyboardShortcuts in Frameworks */,
7E6118152E24071E0050006C /* Sparkle in Frameworks */, 7E6118152E24071E0050006C /* Sparkle in Frameworks */,
@ -174,7 +172,6 @@
14D0321C2C68F3350096E6A1 /* Sparkle */, 14D0321C2C68F3350096E6A1 /* Sparkle */,
B18654382C6F4990000B926A /* KeyboardShortcuts */, B18654382C6F4990000B926A /* KeyboardShortcuts */,
9A987A0F2C73CA8D005CA465 /* Collections */, 9A987A0F2C73CA8D005CA465 /* Collections */,
1485442E2C8F049C00943381 /* TheBoringWorkerNotifier */,
B19016212CC15B3D00E3F12E /* Defaults */, B19016212CC15B3D00E3F12E /* Defaults */,
B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */, B1628B912CC260C0003D8DF3 /* SwiftUIIntrospect */,
B194240A2CD10017003E5DC2 /* LottieUI */, B194240A2CD10017003E5DC2 /* LottieUI */,
@ -215,7 +212,6 @@
14D0321B2C68F3350096E6A1 /* XCRemoteSwiftPackageReference "Sparkle" */, 14D0321B2C68F3350096E6A1 /* XCRemoteSwiftPackageReference "Sparkle" */,
B18654372C6F4990000B926A /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */, B18654372C6F4990000B926A /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */,
9A987A112C73CAA1005CA465 /* XCRemoteSwiftPackageReference "Pow" */, 9A987A112C73CAA1005CA465 /* XCRemoteSwiftPackageReference "Pow" */,
1485442D2C8F049C00943381 /* XCRemoteSwiftPackageReference "TheBoringWorkerNotifier" */,
B19016202CC15B3D00E3F12E /* XCRemoteSwiftPackageReference "Defaults" */, B19016202CC15B3D00E3F12E /* XCRemoteSwiftPackageReference "Defaults" */,
B1628B902CC260C0003D8DF3 /* XCRemoteSwiftPackageReference "swiftui-introspect" */, B1628B902CC260C0003D8DF3 /* XCRemoteSwiftPackageReference "swiftui-introspect" */,
B19424072CD0DB52003E5DC2 /* XCRemoteSwiftPackageReference "LottieUI" */, B19424072CD0DB52003E5DC2 /* XCRemoteSwiftPackageReference "LottieUI" */,
@ -546,14 +542,6 @@
minimumVersion = 0.1.0; 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" */ = { 14D032182C68F32E0096E6A1 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */ = {
isa = XCRemoteSwiftPackageReference; isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin-Modern"; repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin-Modern";
@ -642,11 +630,6 @@
package = 146BC4352D366E9B0047C66A /* XCRemoteSwiftPackageReference "MacroVisionKit" */; package = 146BC4352D366E9B0047C66A /* XCRemoteSwiftPackageReference "MacroVisionKit" */;
productName = MacroVisionKit; productName = MacroVisionKit;
}; };
1485442E2C8F049C00943381 /* TheBoringWorkerNotifier */ = {
isa = XCSwiftPackageProductDependency;
package = 1485442D2C8F049C00943381 /* XCRemoteSwiftPackageReference "TheBoringWorkerNotifier" */;
productName = TheBoringWorkerNotifier;
};
14D032192C68F32E0096E6A1 /* LaunchAtLogin */ = { 14D032192C68F32E0096E6A1 /* LaunchAtLogin */ = {
isa = XCSwiftPackageProductDependency; isa = XCSwiftPackageProductDependency;
package = 14D032182C68F32E0096E6A1 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */; package = 14D032182C68F32E0096E6A1 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */;

View file

@ -1,5 +1,5 @@
{ {
"originHash" : "ac662b7c30c44a46342d90fd2f894c1a70161e39d60b85657ca39c859e894c44", "originHash" : "3b2c9100f16643012ece44ae6bfed9555c2d858d8ac2f98547c70e4c1738f0f6",
"pins" : [ "pins" : [
{ {
"identity" : "defaults", "identity" : "defaults",
@ -117,15 +117,6 @@
"revision" : "807f73ce09a9b9723f12385e592b4e0aaebd3336", "revision" : "807f73ce09a9b9723f12385e592b4e0aaebd3336",
"version" : "1.3.0" "version" : "1.3.0"
} }
},
{
"identity" : "theboringworkernotifier",
"kind" : "remoteSourceControl",
"location" : "https://github.com/TheBoredTeam/TheBoringWorkerNotifier.git",
"state" : {
"branch" : "main",
"revision" : "bc2b292c88035dcfc41fc7e3d8021689e624d137"
}
} }
], ],
"version" : 3 "version" : 3

View file

@ -354,10 +354,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
} }
func applicationDidFinishLaunching(_ notification: Notification) { func applicationDidFinishLaunching(_ notification: Notification) {
LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm)
coordinator.setupWorkersNotificationObservers() LockScreenManager.shared.configure(viewModel: vm)
LockScreenLiveActivityWindowManager.shared.configure(viewModel: vm)
LockScreenManager.shared.configure(viewModel: vm)
// Migrate legacy progress bar settings // Migrate legacy progress bar settings
Defaults.Keys.migrateProgressBarStyle() Defaults.Keys.migrateProgressBarStyle()

View file

@ -8,7 +8,6 @@
import Combine import Combine
import Defaults import Defaults
import SwiftUI import SwiftUI
import TheBoringWorkerNotifier
enum SneakContentType { enum SneakContentType {
case brightness case brightness
@ -34,13 +33,6 @@ struct sneakPeek {
var icon: String = "" var icon: String = ""
} }
struct SharedSneakPeek: Codable {
var show: Bool
var type: String
var value: String
var icon: String
}
enum BrowserType { enum BrowserType {
case chromium case chromium
case safari case safari
@ -55,7 +47,6 @@ struct ExpandedItem {
class DynamicIslandViewCoordinator: ObservableObject { class DynamicIslandViewCoordinator: ObservableObject {
static let shared = DynamicIslandViewCoordinator() static let shared = DynamicIslandViewCoordinator()
var notifier: TheBoringWorkerNotifier
@Published var currentView: NotchViews = .home @Published var currentView: NotchViews = .home
@ -64,7 +55,6 @@ class DynamicIslandViewCoordinator: ObservableObject {
@AppStorage("showWhatsNew") var showWhatsNew: Bool = true @AppStorage("showWhatsNew") var showWhatsNew: Bool = true
@AppStorage("musicLiveActivityEnabled") var musicLiveActivityEnabled: Bool = true @AppStorage("musicLiveActivityEnabled") var musicLiveActivityEnabled: Bool = true
@AppStorage("timerLiveActivityEnabled") var timerLiveActivityEnabled: Bool = true @AppStorage("timerLiveActivityEnabled") var timerLiveActivityEnabled: Bool = true
@AppStorage("currentMicStatus") var currentMicStatus: Bool = true
@AppStorage("alwaysShowTabs") var alwaysShowTabs: Bool = true { @AppStorage("alwaysShowTabs") var alwaysShowTabs: Bool = true {
didSet { didSet {
@ -85,11 +75,7 @@ class DynamicIslandViewCoordinator: ObservableObject {
} }
} }
@AppStorage("hudReplacement") var hudReplacement: Bool = true { @AppStorage("hudReplacement") var hudReplacement: Bool = true
didSet {
notifier.postNotification(name: notifier.toggleHudReplacementNotification.name, userInfo: nil)
}
}
@AppStorage("preferred_screen_name") var preferredScreen = NSScreen.main?.localizedName ?? "Unknown" { @AppStorage("preferred_screen_name") var preferredScreen = NSScreen.main?.localizedName ?? "Unknown" {
didSet { didSet {
@ -103,46 +89,9 @@ class DynamicIslandViewCoordinator: ObservableObject {
@Published var optionKeyPressed: Bool = true @Published var optionKeyPressed: Bool = true
private init() { private init() {
notifier = TheBoringWorkerNotifier()
selectedScreen = preferredScreen 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 = "") { func toggleSneakPeek(status: Bool, type: SneakContentType, duration: TimeInterval = 1.5, value: CGFloat = 0, icon: String = "") {
let resolvedDuration: TimeInterval let resolvedDuration: TimeInterval
switch type { switch type {
@ -168,10 +117,6 @@ class DynamicIslandViewCoordinator: ObservableObject {
self.sneakPeek.icon = icon self.sneakPeek.icon = icon
} }
} }
if type == .mic {
currentMicStatus = value == 1
}
} }
private var sneakPeekDuration: TimeInterval = 1.5 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() { func showEmpty() {
currentView = .home currentView = .home
} }

View file

@ -11035,6 +11035,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." : { "Manage the Clock timer from the Clock app." : {
}, },
@ -12287,6 +12291,10 @@
} }
} }
}, },
"Microphone privacy indicator runs automatically whenever apps access audio." : {
"comment" : "A description of the microphone privacy indicator feature.",
"isCommentAutoGenerated" : true
},
"Microphone Status" : { "Microphone Status" : {
"localizations" : { "localizations" : {
"fr" : { "fr" : {

View file

@ -12,7 +12,6 @@ extension KeyboardShortcuts.Name {
static let clipboardHistoryPanel = Self("clipboardHistoryPanel", default: .init(.c, modifiers: [.shift, .command])) static let clipboardHistoryPanel = Self("clipboardHistoryPanel", default: .init(.c, modifiers: [.shift, .command]))
static let colorPickerPanel = Self("colorPickerPanel", default: .init(.p, 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 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 decreaseBacklight = Self("decreaseBacklight", default: .init(.f1, modifiers: [.command]))
static let increaseBacklight = Self("increaseBacklight", default: .init(.f2, modifiers: [.command])) static let increaseBacklight = Self("increaseBacklight", default: .init(.f2, modifiers: [.command]))
static let toggleSneakPeek = Self("toggleSneakPeek", default: .init(.h, modifiers: [.command, .shift])) static let toggleSneakPeek = Self("toggleSneakPeek", default: .init(.h, modifiers: [.command, .shift]))

View file

@ -72,35 +72,27 @@ func logout() {
} }
struct DynamicIslandSystemTiles: View { struct DynamicIslandSystemTiles: View {
@EnvironmentObject var vm: DynamicIslandViewModel
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
struct ItemButton {
var icon: String
var onTap: () -> Void
}
var body: some View { var body: some View {
Grid { VStack(alignment: .leading, spacing: 6) {
GridRow { Label {
// SystemItemButton(icon: "clipboard", onTap: { Text("Microphone privacy indicator runs automatically whenever apps access audio.")
// vm.openClipboard() .font(.caption)
// }, label: "Clipboard History", showEmojis: Defaults[.showEmojis], emoji: "✨") .foregroundStyle(.gray)
// SystemItemButton(icon: "keyboard", onTap: { .lineLimit(3)
// vm?.close() .multilineTextAlignment(.leading)
// vm?.togglesneakPeek(status: true, type: .backlight, value: 1) } icon: {
// }, label: "💡 Keyboard Backlight") Image(systemName: "shield.lefthalf.filled")
} .foregroundStyle(.gray)
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")
} }
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)
} }
} }

View file

@ -8,7 +8,6 @@
import Combine import Combine
import Defaults import Defaults
import SwiftUI import SwiftUI
import TheBoringWorkerNotifier
class DynamicIslandViewModel: NSObject, ObservableObject { class DynamicIslandViewModel: NSObject, ObservableObject {
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared @ObservedObject var coordinator = DynamicIslandViewCoordinator.shared