Overview
Comment: | Adjust to ObjFW changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
82f79a19ab99fd7cdb6e495212a13828 |
User & Date: | js 2022-08-21 11:58:20 |
Context
2022-11-15
| ||
22:54 | Adjust to ObjFW changes check-in: 7b7392ad32 user: js tags: trunk | |
2022-08-21
| ||
11:58 | Adjust to ObjFW changes check-in: 82f79a19ab user: js tags: trunk | |
2022-06-18
| ||
15:28 | [iOS] Fix missing 0 byte after passphrase check-in: b57405c1d0 user: js tags: trunk | |
Changes
Changes to iOS/SiteStorage.swift.
︙ | ︙ | |||
30 31 32 33 34 35 36 | private var path: OFString private var storage: [String: [NSNumber: AnyObject]] private var sites: [String] override init() { let fileManager = OFFileManager.default | | | | | | < | | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | private var path: OFString private var storage: [String: [NSNumber: AnyObject]] private var sites: [String] override init() { let fileManager = OFFileManager.default let userDataURL = OFSystemInfo.userDataURL! if !fileManager.directoryExists(at: userDataURL) { fileManager.createDirectory(at: userDataURL) } let URL = userDataURL.appendingPathComponent( OFString(utf8String: "sites.msgpack")) var storage: [String: [NSNumber: AnyObject]]? = nil OFException.try({ let decoded = (OFData(contentsOf: URL).objectByParsingMessagePack) as? OFDictionary<OFString, OFDictionary<OFNumber, AnyObject>> storage = (decoded?.nsObject as? [String: [NSNumber: AnyObject]]) ?? [:] }, catch: { (OFException) in storage = [:] }) self.path = URL.fileSystemRepresentation! self.storage = storage! self.sites = self.storage.keys.sorted() } func sites(withFilter filter: String?) -> [String] { return storage.keys.sorted().filter({ (name) in if filter == nil || filter!.isEmpty { return true } return name.localizedCaseInsensitiveContains(filter!) }) } func hasSite(_ name: String) -> Bool { return (storage[name] != nil) } |
︙ | ︙ |