Skip to content

Commit 8ef1b1b

Browse files
🎛️ feat(components): Update UI components
- Enhance settings view layout\n- Improve tab selection behavior\n- Update webcam view functionality
1 parent 3af4e18 commit 8ef1b1b

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

boringNotch/components/Settings/SettingsView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,6 @@ struct Appearance: View {
961961
.tag(MirrorShapeEnum.rectangle)
962962
}
963963
Defaults.Toggle("Show cool face animation while inactivity", key: .showNotHumanFace)
964-
.disabled(true)
965964
} header: {
966965
HStack {
967966
Text("Additional features")

boringNotch/components/Tabs/TabSelectionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ struct TabSelectionView: View {
5151
}
5252

5353
#Preview {
54-
BoringHeader()
54+
BoringHeader().environmentObject(BoringViewModel())
5555
}

boringNotch/components/Webcam/WebcamView.swift

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Defaults
1212
struct CameraPreviewView: View {
1313
@EnvironmentObject var vm: BoringViewModel
1414
@ObservedObject var webcamManager: WebcamManager
15-
15+
1616
var body: some View {
1717
GeometryReader { geometry in
1818
ZStack {
@@ -31,21 +31,42 @@ struct CameraPreviewView: View {
3131
.strokeBorder(.white.opacity(0.04), lineWidth: 1)
3232
.frame(width: geometry.size.width, height: geometry.size.width)
3333
VStack(spacing: 8) {
34-
Image(systemName: "web.camera")
34+
Image(systemName: webcamManager.authorizationStatus == .denied ? "exclamationmark.triangle" : "web.camera")
3535
.foregroundStyle(.gray)
3636
.font(.system(size: geometry.size.width/3.5))
37-
Text("Mirror")
37+
Text(webcamManager.authorizationStatus == .denied ? "Access Denied" : "Mirror")
3838
.font(.caption2)
3939
.foregroundColor(.gray)
4040
}
4141
}
4242
}
4343
}
4444
.onTapGesture {
45-
if webcamManager.isSessionRunning {
46-
webcamManager.stopSession()
47-
} else {
48-
webcamManager.startSession()
45+
switch webcamManager.authorizationStatus {
46+
case .authorized:
47+
if webcamManager.isSessionRunning {
48+
webcamManager.stopSession()
49+
} else {
50+
webcamManager.startSession()
51+
}
52+
case .denied, .restricted:
53+
print("🚫 Camera access denied/restricted from \(#file):\(#line)")
54+
let alert = NSAlert()
55+
alert.messageText = "Camera Access Required"
56+
alert.informativeText = "Please allow camera access in System Settings to use the mirror feature."
57+
alert.addButton(withTitle: "Open Settings")
58+
alert.addButton(withTitle: "Cancel")
59+
60+
if alert.runModal() == .alertFirstButtonReturn {
61+
if let settingsURL = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Camera") {
62+
NSWorkspace.shared.open(settingsURL)
63+
}
64+
}
65+
case .notDetermined:
66+
print("🎥 Checking camera authorization from \(#file):\(#line)")
67+
webcamManager.checkAndRequestVideoAuthorization()
68+
@unknown default:
69+
break
4970
}
5071
}
5172
.onDisappear {

0 commit comments

Comments
 (0)