Skip to content

Open source CapCut alternative.

TypeScript

feat(app): make microphone optional and always offer skip in permission setup

David Le32379c1d4941
diff --git a/apps/Donkey/Sources/Donkey/MacPermissionSetupWindowController.swift b/apps/Donkey/Sources/Donkey/MacPermissionSetupWindowController.swift
index 58a477da..7889f8ab 100644
--- a/apps/Donkey/Sources/Donkey/MacPermissionSetupWindowController.swift
+++ b/apps/Donkey/Sources/Donkey/MacPermissionSetupWindowController.swift
@@ -140,11 +140,9 @@ final class MacPermissionSetupModel: ObservableObject {
completed?()
}
- #if DEBUG
func skipForNow() {
completed?()
}
- #endif
private func rememberRequested(_ kind: MacPermissionKind) {
requestedKinds.insert(kind)
@@ -266,24 +264,13 @@ private struct MacPermissionSetupView: View {
}
}
- HStack(alignment: .top, spacing: 10) {
- Image(systemName: "lock.shield")
- .foregroundStyle(.secondary)
- Text("Donkey uses these permissions only for user-requested tasks and guarded local-app workflows.")
- .font(.footnote)
- .foregroundStyle(.secondary)
- .fixedSize(horizontal: false, vertical: true)
- }
-
Spacer(minLength: 0)
HStack(spacing: 12) {
- #if DEBUG
Button("Skip for now") {
model.skipForNow()
}
.controlSize(.large)
- #endif
Spacer()
@@ -390,9 +377,9 @@ private struct MacPermissionRowView: View {
case .granted:
return "Ready"
case .notDetermined:
- return "Needed"
+ return row.kind.isRequired ? "Needed" : "Optional"
case .denied:
- return "Needs Settings"
+ return row.kind.isRequired ? "Needs Settings" : "Optional"
}
}
@@ -401,9 +388,9 @@ private struct MacPermissionRowView: View {
case .granted:
return .green
case .notDetermined:
- return .orange
+ return row.kind.isRequired ? .orange : .secondary
case .denied:
- return .red
+ return row.kind.isRequired ? .red : .secondary
}
}
diff --git a/apps/Donkey/Sources/DonkeyRuntime/MacPermissionSetupState.swift b/apps/Donkey/Sources/DonkeyRuntime/MacPermissionSetupState.swift
index a9475c29..b6254b29 100644
--- a/apps/Donkey/Sources/DonkeyRuntime/MacPermissionSetupState.swift
+++ b/apps/Donkey/Sources/DonkeyRuntime/MacPermissionSetupState.swift
@@ -9,12 +9,27 @@ public enum MacPermissionKind: String, CaseIterable, Codable, Equatable, Hashabl
rawValue
}
+ /// Every permission shown in the setup window.
public static let coreSetup: [MacPermissionKind] = [
.accessibility,
.screenRecording,
.microphone
]
+ /// The subset that must be granted before the user can continue. Microphone backs only the
+ /// optional voice input, so it never blocks setup — and macOS keeps reporting it `.denied` to a
+ /// running process until relaunch, which would otherwise wall the user in here forever.
+ public static let requiredSetup: [MacPermissionKind] = coreSetup.filter(\.isRequired)
+
+ public var isRequired: Bool {
+ switch self {
+ case .accessibility, .screenRecording:
+ return true
+ case .microphone:
+ return false
+ }
+ }
+
public var title: String {
switch self {
case .accessibility:
@@ -123,7 +138,7 @@ public struct MacPermissionSetupStateResolver: Sendable {
public func allRequiredPermissionsGranted(
statuses: [MacPermissionKind: MacPermissionAuthorizationStatus],
- requiredKinds: [MacPermissionKind] = MacPermissionKind.coreSetup
+ requiredKinds: [MacPermissionKind] = MacPermissionKind.requiredSetup
) -> Bool {
requiredKinds.allSatisfy { statuses[$0] == .granted }
}
diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/MacPermissionSetupStateTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/MacPermissionSetupStateTests.swift
index d1df7c77..d6c25062 100644
--- a/apps/Donkey/Tests/DonkeyRuntimeTests/MacPermissionSetupStateTests.swift
+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/MacPermissionSetupStateTests.swift
@@ -46,4 +46,18 @@ struct MacPermissionSetupStateTests {
.microphone: .granted
]))
}
+
+ @Test
+ func microphoneIsOptionalAndDoesNotBlockContinue() {
+ let resolver = MacPermissionSetupStateResolver()
+
+ #expect(!MacPermissionKind.microphone.isRequired)
+ #expect(!MacPermissionKind.requiredSetup.contains(.microphone))
+ // Required permissions granted, microphone denied — the user can still continue.
+ #expect(resolver.allRequiredPermissionsGranted(statuses: [
+ .accessibility: .granted,
+ .screenRecording: .granted,
+ .microphone: .denied
+ ]))
+ }
}