mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Dactyloidae iOS initial commit
This commit is contained in:
parent
daa6179d22
commit
7154a0497e
2123 changed files with 197052 additions and 0 deletions
37
mobile/ios/ReadingList/ReadingListServerMetadata.swift
Normal file
37
mobile/ios/ReadingList/ReadingListServerMetadata.swift
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ReadingListServerMetadata: Equatable {
|
||||
public var guid: String
|
||||
public var lastModified: ReadingListTimestamp
|
||||
|
||||
init(guid: String, lastModified: ReadingListTimestamp) {
|
||||
self.guid = guid
|
||||
self.lastModified = lastModified
|
||||
}
|
||||
|
||||
/// Initialize from server record.
|
||||
init?(json: [String: Any]) {
|
||||
self.init(data: json)
|
||||
}
|
||||
|
||||
init?(row: [String: Any]) {
|
||||
self.init(data: row)
|
||||
}
|
||||
|
||||
private init?(data: [String: Any]) {
|
||||
guard let guid = data["id"] as? String,
|
||||
let lastModified = data["last_modified"] as? Int64 else {
|
||||
return nil
|
||||
}
|
||||
self.guid = guid
|
||||
self.lastModified = lastModified
|
||||
}
|
||||
}
|
||||
|
||||
public func ==(lhs: ReadingListServerMetadata, rhs: ReadingListServerMetadata) -> Bool {
|
||||
return lhs.guid == rhs.guid && lhs.lastModified == rhs.lastModified
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue