Post

Replies

Boosts

Views

Activity

How to run Timer into the ShieldActionExtension to wait user for 5 second to unlock the app?
// Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. class ShieldActionExtension: ShieldActionDelegate {   override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     switch action {       case .primaryButtonPressed:         completionHandler(.defer)       case .secondaryButtonPressed:         Timer(timeInterval: 5, repeats: false) { timer in           Restrictions.shared.unlockedAllApps()         }                   completionHandler(.defer)       @unknown default:         fatalError()     }   }           override func handle(action: ShieldAction, for webDomain: WebDomainToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     print("func handle(action: ShieldAction, for webDomain: WebDomainToken,")     completionHandler(.close)   }       override func handle(action: ShieldAction, for category: ActivityCategoryToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     NSLog("handle(action: ShieldAction, for category: ActivityCategoryToken")     completionHandler(.defer)   } }
2
0
1.1k
Feb ’23
FamilyActiviySelections
Below code for AppStorage gives me error as: "No exact matches in call to initializer" Can anyone please provide how to fix it? I am using code 14.2 and Family controls Capability. @AppStorage("shieldedApps", store: UserDefaults(suiteName: "group.com.myapp.timeout")) var selectionToDiscourage = FamilyActivitySelection() {     willSet {       UserDefaults.standard.setValue(true, forKey: "appSelected")       print("got here (newValue)")       for category in newValue.categories {         print(category.localizedDisplayName)       }       let applications = newValue.applicationTokens       let categories = newValue.categoryTokens       // let webCategories = newValue.webDomainTokens       store.shield.applications = applications.isEmpty ? nil : applications       store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())       store.shield.webDomainCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())             }   }
0
0
501
Feb ’23