mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 17:51:01 +00:00
Optimize viewId (#942)
This commit is contained in:
parent
159bd74566
commit
5faf793fe2
1 changed files with 8 additions and 6 deletions
|
@ -26,7 +26,7 @@ public enum Visibility: String, Codable, CaseIterable, Hashable, Equatable, Send
|
|||
}
|
||||
|
||||
public protocol AnyStatus {
|
||||
var viewId: String { get }
|
||||
var viewId: StatusViewId { get }
|
||||
var id: String { get }
|
||||
var content: HTMLString { get }
|
||||
var account: Account { get }
|
||||
|
@ -55,12 +55,14 @@ public protocol AnyStatus {
|
|||
var language: String? { get }
|
||||
}
|
||||
|
||||
public struct StatusViewId: Hashable {
|
||||
let id: String
|
||||
let editedAt: ServerDate?
|
||||
}
|
||||
|
||||
public extension AnyStatus {
|
||||
var viewId: String {
|
||||
if let editedAt {
|
||||
return "\(id)\(editedAt.asDate.description)"
|
||||
}
|
||||
return id
|
||||
var viewId: StatusViewId {
|
||||
StatusViewId(id: id, editedAt: editedAt)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue