mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-03-01 00:35:19 +08:00
feat: search support
This commit is contained in:
@@ -9,9 +9,20 @@ import SwiftUI
|
||||
struct RuleProvidersRowView: View {
|
||||
|
||||
@ObservedObject var providerStorage: DBProviderStorage
|
||||
@EnvironmentObject var searchString: ProxiesSearchString
|
||||
|
||||
@State private var isUpdating = false
|
||||
|
||||
var providers: [DBRuleProvider] {
|
||||
if searchString.string.isEmpty {
|
||||
return providerStorage.ruleProviders
|
||||
} else {
|
||||
return providerStorage.ruleProviders.filter {
|
||||
$0.name.lowercased().contains(searchString.string.lowercased())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationLink {
|
||||
contentView
|
||||
@@ -26,7 +37,7 @@ struct RuleProvidersRowView: View {
|
||||
ScrollView {
|
||||
Section {
|
||||
VStack(spacing: 12) {
|
||||
ForEach(providerStorage.ruleProviders, id: \.id) {
|
||||
ForEach(providers, id: \.id) {
|
||||
RuleProviderView(provider: $0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user