mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-02-04 10:02:26 +08:00
feat: empty provider
This commit is contained in:
@@ -16,25 +16,7 @@ struct ProvidersView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
NavigationView {
|
NavigationView {
|
||||||
List {
|
listView
|
||||||
Section("Providers") {
|
|
||||||
ProxyProvidersRowView(providerStorage: providerStorage)
|
|
||||||
RuleProvidersRowView(providerStorage: providerStorage)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text("")
|
|
||||||
|
|
||||||
Section("Proxy Provider") {
|
|
||||||
ForEach(providerStorage.proxyProviders,id: \.id) {
|
|
||||||
ProviderRowView(proxyProvider: $0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.introspectTableView {
|
|
||||||
$0.refusesFirstResponder = true
|
|
||||||
$0.doubleAction = nil
|
|
||||||
}
|
|
||||||
.listStyle(.plain)
|
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
.searchable(text: $searchString.string)
|
.searchable(text: $searchString.string)
|
||||||
@@ -54,6 +36,40 @@ struct ProvidersView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var listView: some View {
|
||||||
|
List {
|
||||||
|
if providerStorage.proxyProviders.isEmpty,
|
||||||
|
providerStorage.ruleProviders.isEmpty {
|
||||||
|
Text("Empty")
|
||||||
|
.padding()
|
||||||
|
} else {
|
||||||
|
Section("Providers") {
|
||||||
|
if !providerStorage.proxyProviders.isEmpty {
|
||||||
|
ProxyProvidersRowView(providerStorage: providerStorage)
|
||||||
|
}
|
||||||
|
if !providerStorage.ruleProviders.isEmpty {
|
||||||
|
RuleProvidersRowView(providerStorage: providerStorage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !providerStorage.proxyProviders.isEmpty {
|
||||||
|
Text("")
|
||||||
|
|
||||||
|
Section("Proxy Provider") {
|
||||||
|
ForEach(providerStorage.proxyProviders,id: \.id) {
|
||||||
|
ProviderRowView(proxyProvider: $0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.introspectTableView {
|
||||||
|
$0.refusesFirstResponder = true
|
||||||
|
$0.doubleAction = nil
|
||||||
|
}
|
||||||
|
.listStyle(.plain)
|
||||||
|
}
|
||||||
|
|
||||||
func loadProviders() {
|
func loadProviders() {
|
||||||
ApiRequest.requestProxyProviderList { resp in
|
ApiRequest.requestProxyProviderList { resp in
|
||||||
providerStorage.proxyProviders = resp.allProviders.values.filter {
|
providerStorage.proxyProviders = resp.allProviders.values.filter {
|
||||||
|
|||||||
Reference in New Issue
Block a user