mac settings: remove dupe section

This commit is contained in:
Peter Steinberger 2025-07-28 14:13:14 +02:00
parent 6bd269f71a
commit 6a918aeab6

View file

@ -188,118 +188,6 @@ private struct SecuritySection: View {
}
}
// MARK: - Permissions Section
private struct PermissionsSection: View {
let hasAppleScriptPermission: Bool
let hasAccessibilityPermission: Bool
let permissionManager: SystemPermissionManager
var body: some View {
Section {
// Automation permission
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("Terminal Automation")
.font(.body)
Text("Required to launch and control terminal applications.")
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
if hasAppleScriptPermission {
HStack {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)
Text("Granted")
.foregroundColor(.secondary)
}
.font(.caption)
.padding(.horizontal, 10)
.padding(.vertical, 2)
.frame(height: 22) // Match small button height
.contextMenu {
Button("Refresh Status") {
permissionManager.forcePermissionRecheck()
}
Button("Open System Settings...") {
permissionManager.requestPermission(.appleScript)
}
}
} else {
Button("Grant Permission") {
permissionManager.requestPermission(.appleScript)
}
.buttonStyle(.bordered)
.controlSize(.small)
}
}
// Accessibility permission
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("Accessibility")
.font(.body)
Text("Required to enter terminal startup commands.")
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
if hasAccessibilityPermission {
HStack {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)
Text("Granted")
.foregroundColor(.secondary)
}
.font(.caption)
.padding(.horizontal, 10)
.padding(.vertical, 2)
.frame(height: 22) // Match small button height
.contextMenu {
Button("Refresh Status") {
permissionManager.forcePermissionRecheck()
}
Button("Open System Settings...") {
permissionManager.requestPermission(.accessibility)
}
}
} else {
Button("Grant Permission") {
permissionManager.requestPermission(.accessibility)
}
.buttonStyle(.bordered)
.controlSize(.small)
}
}
} header: {
Text("System Permissions")
.font(.headline)
} footer: {
if hasAppleScriptPermission && hasAccessibilityPermission {
Text(
"All permissions granted. VibeTunnel has full functionality."
)
.font(.caption)
.frame(maxWidth: .infinity)
.multilineTextAlignment(.center)
.foregroundColor(.green)
} else {
Text(
"Terminals can be captured without permissions, however new sessions won't load."
)
.font(.caption)
.frame(maxWidth: .infinity)
.multilineTextAlignment(.center)
}
}
}
}
// MARK: - Previews
#Preview("Security & Permissions Settings") {