Dont allow deleting system labels

This commit is contained in:
Jackson Harper
2023-12-23 22:25:20 +08:00
parent 98ad40fa6b
commit 0bd710e639
2 changed files with 36 additions and 32 deletions

View File

@ -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)
// })
}
}

View File

@ -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