Files
damus/damus/Views/RelayFilterView.swift
William Casarin f702733654 nav: remove environmentObjects
environment objects are implicit arguments that cannot be checked by the
compiler. They are a common source of crashes. Use a main
NavigationCoordinator in DamusState for the core app, and pass in other
coordinators in the account setup view for the parts of the app that
don't have a DamusState.
2023-06-30 09:59:58 -07:00

42 lines
1.1 KiB
Swift

//
// RelayFilterView.swift
// damus
//
// Created by Ben Weeks on 1/8/23.
//
import SwiftUI
struct RelayFilterView: View {
let state: DamusState
let timeline: Timeline
init(state: DamusState, timeline: Timeline) {
self.state = state
self.timeline = timeline
//_relays = State(initialValue: state.pool.descriptors)
}
var relays: [RelayDescriptor] {
return state.pool.our_descriptors
}
var body: some View {
Text("Please choose relays from the list below to filter the current feed:", comment: "Instructions on how to filter a specific timeline feed by choosing relay servers to filter on.")
.padding()
.padding(.top, 20)
.padding(.bottom, 0)
List(Array(relays), id: \.url.id) { relay in
RelayToggle(state: state, timeline: timeline, relay_id: relay.url.url.absoluteString)
}
}
}
struct RelayFilterView_Previews: PreviewProvider {
static var previews: some View {
RelayFilterView(state: test_damus_state(), timeline: .search)
}
}