From 5587b9902aebdc38cc6293359d9a0141e5232f26 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 22 Sep 2024 15:41:53 +0200 Subject: [PATCH] Allow deletion of TV profiles Fixes #480 --- Passepartout/App/Views/TV/OrganizerView+TV.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Passepartout/App/Views/TV/OrganizerView+TV.swift b/Passepartout/App/Views/TV/OrganizerView+TV.swift index f2ec10b0..020a7bb7 100644 --- a/Passepartout/App/Views/TV/OrganizerView+TV.swift +++ b/Passepartout/App/Views/TV/OrganizerView+TV.swift @@ -42,6 +42,7 @@ struct OrganizerView: View { List { ActiveProfileView(profileManager: profileManager) aboutSection + deleteSection } .navigationTitle(Unlocalized.appName) .themeTV() @@ -63,6 +64,19 @@ private extension OrganizerView { Text(L10n.About.title) } } + + var deleteSection: some View { + Section { + Button(L10n.Global.Strings.delete, role: .destructive) { + profileManager.activeProfileId.map { profileId in + withAnimation { + profileManager.removeProfiles(withIds: [profileId]) + } + } + } + .disabled(!profileManager.hasActiveProfile) + } + } } // MARK: Mock