Hi jerobern, thanks for commenting 🙂
Interesting, I have tried setting for all blocking types - application, application category, webdomain and webdomain category. I just provided a single example to keep things more concise initially, but probably not such a good approach in hindsight. That said, your comments have drawn attention to the fact that I'm using a probably less-standard method for applying the shield .all()
, so wonder whether this might be causing some side effects and limiting the shield config from applying.
Use of ".all()" to shield
import Foundation
import DeviceActivity
import ManagedSettings
extension ManagedSettingsStore.Name {
static let social = Self("social")
}
func setShieldSettingsForAll() {
let store = ManagedSettingsStore(named: .social)
store.shield.applicationCategories = .all()
store.shield.webDomainCategories = .all()
logger.log("All Applications Set")
}
Entire Sheild Config
import ManagedSettings
import ManagedSettingsUI
import UIKit
class ShieldConfigurationExtension: ShieldConfigurationDataSource {
override func configuration(shielding application: Application) -> ShieldConfiguration {
// Customize the shield as needed for applications.
return ShieldConfiguration(
backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,
backgroundColor: UIColor.white,
icon: UIImage(systemName: "stopwatch"),
title: ShieldConfiguration.Label(text: "No app for you", color: .yellow),
subtitle: ShieldConfiguration.Label(text: "Sorry, no apps for you", color: .white),
primaryButtonLabel: ShieldConfiguration.Label(text: "Ask for a break?", color: .white),
secondaryButtonLabel: ShieldConfiguration.Label(text: "Quick Quick", color: .white)
)
}
override func configuration(shielding application: Application, in category: ActivityCategory) -> ShieldConfiguration {
// Customize the shield as needed for applications shielded because of their category.
return ShieldConfiguration(
backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,
backgroundColor: UIColor.white,
icon: UIImage(systemName: "stopwatch"),
title: ShieldConfiguration.Label(text: "No app for you", color: .yellow),
subtitle: ShieldConfiguration.Label(text: "Sorry, no apps for you", color: .white),
primaryButtonLabel: ShieldConfiguration.Label(text: "Ask for a break?", color: .white),
secondaryButtonLabel: ShieldConfiguration.Label(text: "Quick Quick", color: .white)
)
}
override func configuration(shielding webDomain: WebDomain) -> ShieldConfiguration {
// Customize the shield as needed for web domains.
return ShieldConfiguration(
backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,
backgroundColor: UIColor.white,
icon: UIImage(systemName: "stopwatch"),
title: ShieldConfiguration.Label(text: "No app for you", color: .yellow),
subtitle: ShieldConfiguration.Label(text: "Sorry, no apps for you", color: .white),
primaryButtonLabel: ShieldConfiguration.Label(text: "Ask for a break?", color: .white),
secondaryButtonLabel: ShieldConfiguration.Label(text: "Quick Quick", color: .white)
)
}
override func configuration(shielding webDomain: WebDomain, in category: ActivityCategory) -> ShieldConfiguration {
// Customize the shield as needed for web domains shielded because of their category.
return ShieldConfiguration(
backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,
backgroundColor: UIColor.white,
icon: UIImage(systemName: "stopwatch"),
title: ShieldConfiguration.Label(text: "No app for you", color: .yellow),
subtitle: ShieldConfiguration.Label(text: "Sorry, no apps for you", color: .white),
primaryButtonLabel: ShieldConfiguration.Label(text: "Ask for a break?", color: .white),
secondaryButtonLabel: ShieldConfiguration.Label(text: "Quick Quick", color: .white)
)
}
}
I will try tweaking my shielding method and see if that changes things 🤞