From c9ef40f00f24d43a2dc385e60336539e46ff875a Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:28:34 +0200 Subject: [PATCH] refactor(apple): tidy the receive-folder preference row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Save received transfers to" section was a gray folder label that read like a disabled field, stacked above two full-width buttons. Replace it with the standard macOS "label · value · inline action" row: a folder icon + the current folder name with a trailing "Choose folder" button, long names truncated in the middle. "Use default" now shows only when a custom folder is actually set (hidden when already on the default, where it'd be a no-op). --- .../Features/Settings/SettingsModel.swift | 9 +++++++++ .../Features/Settings/SettingsSections.swift | 18 ++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/apple/VniDrop/Features/Settings/SettingsModel.swift b/apple/VniDrop/Features/Settings/SettingsModel.swift index 2ddc6b0..a6a3f3c 100644 --- a/apple/VniDrop/Features/Settings/SettingsModel.swift +++ b/apple/VniDrop/Features/Settings/SettingsModel.swift @@ -168,6 +168,15 @@ final class SettingsModel: ObservableObject { func onReceiveFolderPickFailed(_ reason: String) { messages.error(InvitationError.message(reason)) } func resetReceiveFolder() { preferences.resetReceiveFolder() } + /// Whether the current receive folder is the platform default (so the reset + /// action can be hidden when it would be a no-op). Compared by location, not + /// display name, which can differ once resolved. + var isUsingDefaultReceiveFolder: Bool { + guard let folder = state.receiveFolder else { return true } + let fallback = fileSystemService.defaultReceiveFolder() + return folder.kind == fallback.kind && folder.value == fallback.value + } + /// Ask the OS for notification permission. This is the only time the app can /// grant it; disabling or fine-tuning afterwards happens in the Settings app. func requestNotifications() { diff --git a/apple/VniDrop/Features/Settings/SettingsSections.swift b/apple/VniDrop/Features/Settings/SettingsSections.swift index 509c4b6..8457dd4 100644 --- a/apple/VniDrop/Features/Settings/SettingsSections.swift +++ b/apple/VniDrop/Features/Settings/SettingsSections.swift @@ -14,10 +14,20 @@ struct PreferencesSettings: View { } if model.state.supportsCustomReceiveFolders { Section(String(localized: L10n.Preferences.receiveFolderTitle)) { - Text(model.state.receiveFolder?.displayName ?? String(localized: L10n.Value.unavailable)) - .foregroundStyle(.secondary) - Button(String(localized: L10n.Button.chooseFolder), action: model.chooseReceiveFolder) - Button(String(localized: L10n.Button.resetDefault), action: model.resetReceiveFolder) + LabeledContent { + Button(String(localized: L10n.Button.chooseFolder), action: model.chooseReceiveFolder) + } label: { + Label { + Text(model.state.receiveFolder?.displayName ?? String(localized: L10n.Value.unavailable)) + .lineLimit(1) + .truncationMode(.middle) + } icon: { + Image(systemSymbol: .folder) + } + } + if !model.isUsingDefaultReceiveFolder { + Button(String(localized: L10n.Button.resetDefault), role: .cancel, action: model.resetReceiveFolder) + } } } }