Issue #2: Use ViewModel to evaluate server to use for counting number of blocked domains.
This commit is contained in:
parent
6b253a6843
commit
634b4d26e8
1 changed files with 6 additions and 2 deletions
|
|
@ -4,7 +4,10 @@ import Foundation
|
||||||
|
|
||||||
struct BlockedCount: View {
|
struct BlockedCount: View {
|
||||||
|
|
||||||
@State private var txtRecord: String = "..."
|
@EnvironmentObject
|
||||||
|
private var viewModel: ViewModel
|
||||||
|
|
||||||
|
@State private var txtRecord: String = "…"
|
||||||
|
|
||||||
private static let startIndex = 44
|
private static let startIndex = 44
|
||||||
|
|
||||||
|
|
@ -44,7 +47,7 @@ struct BlockedCount: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchTXTRecord() {
|
func fetchTXTRecord() {
|
||||||
let dohURL = URL(string: "https://dns.sr2.uk/dns-query?dns=DoQBAAABAAAAAAAABXN0YXRzB2ludmFsaWQAABAAAQ")!
|
let dohURL = URL(string: "https://\(viewModel.blocklist.server)/dns-query?dns=DoQBAAABAAAAAAAABXN0YXRzB2ludmFsaWQAABAAAQ")!
|
||||||
|
|
||||||
let request = URLRequest(url: dohURL)
|
let request = URLRequest(url: dohURL)
|
||||||
|
|
||||||
|
|
@ -68,4 +71,5 @@ struct BlockedCount: View {
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
BlockedCount()
|
BlockedCount()
|
||||||
|
.environmentObject(ViewModel())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue