London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
11.1 C
New York
Sunday, November 24, 2024

ios – How do I unshield and protect apps with Display screen Time API?


So I already made it doable to unshield and protect a particular app when you hit the first button of the protect configuration.

class ShieldActionExtension: ShieldActionDelegate {
    override func deal with(motion: ShieldAction, for software: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {
        change motion {
        case .primaryButtonPressed:
            
            unlockandreapply(for: software)
            completionHandler(.none)
        case .secondaryButtonPressed:
            
            completionHandler(.none)
        @unknown default:
            fatalError()
        }
    }
    
    func unlockandreapply(for software: ApplicationToken)
    {
        unlockApp(for: software)
        
        // Schedule timer to reshield after 10 seconds
        DispatchQueue.most important.asyncAfter(deadline: .now() + 10) {
            self.reapplyShield(for: software)
            
            
        }
    }
    non-public func unlockApp(for software: ApplicationToken) {
        let retailer = ManagedSettingsStore()
        retailer.protect.purposes?.take away(software)
        print("App (software) is unshielded")
    }
    
    // Reapplies the protect to the applying
    non-public func reapplyShield(for software: ApplicationToken) {
        let retailer = ManagedSettingsStore()
        
        // Create a brand new protect configuration if mandatory
        if retailer.protect.purposes == nil {
            retailer.protect.purposes = [application]
        } else {
            retailer.protect.purposes?.insert(software)
        }
        print("Defend reapplied to software with token (software)")
    }
} 

Nonetheless is it doable to unshield and protect apps outdoors of The Defend motion extension? Till now I may solely get the unshielding to work outdoors of the extension, however the reshielding by no means labored within the background, this solely labored inside the extension. My aim is to have a button in my very own app which then may unshield and reshield completely within the background identical to my present major button of the protect configuration…

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com