Filters view UI tweaks
This commit is contained in:
parent
f71804f094
commit
fcf95ba8c1
|
@ -16,7 +16,7 @@ struct FilterRow: View {
|
|||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack(alignment: .top) {
|
||||
Text(mastodonController.instanceFeatures.filtersV2 ? filter.title ?? "" : filter.keywordMOs.first!.keyword)
|
||||
Text(mastodonController.instanceFeatures.filtersV2 ? filter.title ?? "" : filter.keywordMOs.first?.keyword ?? "")
|
||||
.font(.headline)
|
||||
|
||||
Spacer()
|
||||
|
@ -41,7 +41,7 @@ struct FilterRow: View {
|
|||
Text(FilterV1.Context.allCases.filter { filter.contexts.contains($0) }.map(\.displayName).formatted())
|
||||
.font(.subheadline)
|
||||
|
||||
if !mastodonController.instanceFeatures.filtersV2 && filter.keywordMOs.first!.wholeWord {
|
||||
if !mastodonController.instanceFeatures.filtersV2 && filter.keywordMOs.first?.wholeWord == true {
|
||||
Text("Whole word")
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
|
|
|
@ -82,7 +82,9 @@ struct FiltersList: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func filtersSection(_ filters: [FilterMO], header: some View) -> some View {
|
||||
if !filters.isEmpty {
|
||||
Section {
|
||||
ForEach(filters, id: \.id) { filter in
|
||||
NavigationLink {
|
||||
|
@ -94,9 +96,8 @@ struct FiltersList: View {
|
|||
Button(role: .destructive) {
|
||||
deleteFilter(filter)
|
||||
} label: {
|
||||
Text("Delete Filter")
|
||||
Label("Delete Filter", systemImage: "trash")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.onDelete { indices in
|
||||
|
@ -108,6 +109,7 @@ struct FiltersList: View {
|
|||
header
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func deleteFilter(_ filter: FilterMO) {
|
||||
Task {
|
||||
|
|
|
@ -96,10 +96,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(sceneWillEnterForeground), name: UIScene.willEnterForegroundNotification, object: nil)
|
||||
|
||||
mastodonController.run(Client.getFiltersV2()) { response in
|
||||
print(response)
|
||||
}
|
||||
}
|
||||
|
||||
// separate method because InstanceTimelineViewController needs to be able to customize it
|
||||
|
|
Loading…
Reference in New Issue