I want to block specific Websites with FamilyControls
in my App. To do this, I need to access the WebDomainTokens
of a specific Website, without the user selecting it in the FamilyActivityPicker.
I basically just want to have a button e.g. "Block Instagram" and when clicking it, the instagram website is blocked. I don't see any way in accessing the WebDomainToken
without the FamilyActivityPicker.
Or is there maybe another approach to this problem?
Currently I tried the following:
var selectionToDiscourage = FamilyActivitySelection() {
willSet {
let applications = newValue.applicationTokens
store.shield.applications = applications.isEmpty ? nil : applications
let webDomain: WebDomain = .init(domain: "https://www.instagram.com/")
print("TOKEN: \(webDomain.token)")
print("DOMAIN: \(webDomain.domain)")
if let webDomainToken = webDomain.token {
let webDomainTokenSet: Set<WebDomainToken> = [webDomainToken]
store.shield.webDomains = webDomainTokenSet
}
}
}
But when only giving the domain, the token always prints nil. Hope someone can help!