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