38 lines
1.5 KiB
Swift
38 lines
1.5 KiB
Swift
import ManagedSettings
|
|
import ManagedSettingsUI
|
|
import UIKit
|
|
|
|
final class ShieldConfigurationExtension: ShieldConfigurationDataSource {
|
|
override func configuration(shielding application: Application) -> ShieldConfiguration {
|
|
makeConfiguration()
|
|
}
|
|
|
|
override func configuration(shielding application: Application, in category: ActivityCategory) -> ShieldConfiguration {
|
|
makeConfiguration()
|
|
}
|
|
|
|
override func configuration(shielding webDomain: WebDomain) -> ShieldConfiguration {
|
|
makeConfiguration()
|
|
}
|
|
|
|
override func configuration(shielding webDomain: WebDomain, in category: ActivityCategory) -> ShieldConfiguration {
|
|
makeConfiguration()
|
|
}
|
|
|
|
private func makeConfiguration() -> ShieldConfiguration {
|
|
let config = AppRestrictSharedStore.shieldConfig
|
|
let image = AppRestrictSharedStore.loadShieldDisplayImage()
|
|
let titleColor = UIColor.white
|
|
let bodyColor = UIColor.white
|
|
return ShieldConfiguration(
|
|
backgroundBlurStyle: .systemMaterialDark,
|
|
backgroundColor: .black,
|
|
icon: image,
|
|
title: ShieldConfiguration.Label(text: config.title, color: titleColor),
|
|
subtitle: ShieldConfiguration.Label(text: "\n\(config.subtitle)", color: bodyColor),
|
|
primaryButtonLabel: ShieldConfiguration.Label(text: config.primaryButtonLabel, color: .white),
|
|
primaryButtonBackgroundColor: UIColor(red: 0.09, green: 0.70, blue: 1.0, alpha: 1)
|
|
)
|
|
}
|
|
}
|