On pressing the secondary button on my ShieldConfigurationExtension, I remove the shields by setting shields in the named ManagedStore to nil in my ShieldActionExtension.
// ShieldActionExtension.swift
let store = ManagedSettingsStore()
store.shield.applications = nil
store.shield.applicationCategories = nil
Now after some duration I want to re-apply the shields again for which I do the following:
// ShieldActionExtension.swift
DispatchQueue.main.asyncAfter(deadline: .now() + unlockDuration) { [weak self] in
self?.reapplyShields(for: sessionId, application: application)
}
private func reapplyShields(for sessionId: String, application: ApplicationToken) {
store.shield.applications = Set([application])
}
Followed by the completionHandler:
// ShieldActionExtension.swift
completionHandler(.defer)
Now the expectation is ShieldConfigurationExtension should be re-triggered with store.shield.applications = Set([application]), however I see the default iOS screen time shield.
This behavior is experience when the blocked app is running in the foreground. However, if I close and re-open the blocked app - the ShieldConfigurationExtension is trigerred again correctly.
If I do a completionHandler(.none) instead, the overriden configuration method in ShieldConfigurationExtension is not triggered.
How do I make sure ShieldConfigurationExtension is triggered if the blocked app is running in the foreground when the shields are re-applied again?