From 0bd710e639f93b53ddc5a6c2a1cdbc98dc1f17e3 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Sat, 23 Dec 2023 22:25:20 +0800 Subject: [PATCH] Dont allow deleting system labels --- .../AudioPlayer/ExpandedAudioPlayer.swift | 50 ++++++++++--------- .../Sources/App/Views/Labels/LabelsView.swift | 18 ++++--- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedAudioPlayer.swift b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedAudioPlayer.swift index bb10c84fc..cf58b7558 100644 --- a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedAudioPlayer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedAudioPlayer.swift @@ -98,33 +98,35 @@ } ).padding(.trailing, 5) - Button( - action: { performArchive() }, - label: { - if audioController.itemAudioProperties?.isArchived ?? false { - Image - .toolbarUnarchive - .foregroundColor(ThemeManager.currentTheme.toolbarColor) - } else { - Image - .toolbarArchive - .foregroundColor(ThemeManager.currentTheme.toolbarColor) - } - } - ).padding(.trailing, 5) - - Menu(content: { + if !(audioController.itemAudioProperties?.isArchived ?? false) { Button( - action: { performViewArticle() }, + action: { performArchive() }, label: { - Text("View article") + if audioController.itemAudioProperties?.isArchived ?? false { + Image + .toolbarUnarchive + .foregroundColor(ThemeManager.currentTheme.toolbarColor) + } else { + Image + .toolbarArchive + .foregroundColor(ThemeManager.currentTheme.toolbarColor) + } } - ) - }, label: { - Image - .utilityMenu - .foregroundColor(ThemeManager.currentTheme.toolbarColor) - }) + ).padding(.trailing, 5) + } + +// Menu(content: { +// Button( +// action: { performViewArticle() }, +// label: { +// Text("View article") +// } +// ) +// }, label: { +// Image +// .utilityMenu +// .foregroundColor(ThemeManager.currentTheme.toolbarColor) +// }) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift index e7474c1ad..56e0241f4 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift @@ -12,7 +12,7 @@ struct LabelsView: View { @Environment(\.dismiss) private var dismiss - @AppStorage(UserDefaultKey.hideSystemLabels.rawValue, store: UserDefaults(suiteName: "group.app.omnivoreapp")) var hideSystemLabels = false + @AppStorage(UserDefaultKey.hideSystemLabels.rawValue) var hideSystemLabels = false var body: some View { List { @@ -21,13 +21,15 @@ struct LabelsView: View { HStack { TextChip(feedItemLabel: label).allowsHitTesting(false) Spacer() - Button( - action: { - labelToRemove = label - showDeleteConfirmation = true - }, - label: { Image(systemName: "trash") } - ) + if !isSystemLabel(label) { + Button( + action: { + labelToRemove = label + showDeleteConfirmation = true + }, + label: { Image(systemName: "trash") } + ) + } } } createLabelButton