When I tap on one of the buttons in the ShieldAction extension I want to close the shield and open the parent app instead of the shielded app. Is there any way of doing this using the Screen Time API?
class ShieldActionExtension: ShieldActionDelegate {
override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {
// Handle the action as needed.
let store = ManagedSettingsStore()
switch action {
case .primaryButtonPressed:
//TODO - open parent app
completionHandler(.defer)
case .secondaryButtonPressed:
//remove shield
store.shield.applications?.remove(application)
completionHandler(.defer)
@unknown default:
fatalError()
}
}
}
There's no supported way for you to your extension to open your main app with the APIs currently available. If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?