// // KMBotaTools.swift // PDF Reader Pro // // Created by tangchao on 2024/3/23. // import Cocoa class KMBotaTools: NSObject { } // MARK: - Note extension KMBotaTools { // filter class func noteFilterIsEmpty(key: String) -> Bool { return self.noteFilterAllTypes(key: key).isEmpty } class func noteFilterAllTypes(key: String) -> [Any] { return self.noteFilterAnnoTypes(key: key) + self.noteFilterColors(key: key) + self.noteFilterAuthors(key: key) } class func noteFilterAnnoTypes(key: String) -> [String] { if let data = KMDataManager.ud_object(forKey: NoteFilterVC.filterSelectTypeKey + key) as? Data { return (NSKeyedUnarchiver.unarchiveObject(with: data) as? [String]) ?? [] } return [] } class func noteFilterColors(key: String) -> [Any] { if let data = KMDataManager.ud_object(forKey: NoteFilterVC.filterSelectColorKey + key) as? Data { return (NSKeyedUnarchiver.unarchiveObject(with: data) as? [Any]) ?? [] } return [] } class func noteFilterAuthors(key: String) -> [String] { if let data = KMDataManager.ud_object(forKey: NoteFilterVC.filterSelectAuthorKey + key) as? Data { return (NSKeyedUnarchiver.unarchiveObject(with: data) as? [String]) ?? [] } return [] } class func noteFilterStates(key: String) -> [NSNumber] { if let data = KMDataManager.ud_object(forKey: NoteFilterVC.filterSelectStateKey + key) as? Data { return (NSKeyedUnarchiver.unarchiveObject(with: data) as? [NSNumber]) ?? [] } return [] } }