1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //
- // 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 []
- }
- }
|