forked from shadowfacts/Tusker
Shadowfacts
b47b08fa95
Also, copy the state between screens, so e.g. expanding a status in the timeline and then opening that conversation already has that status expanded. This intentionally doesn't store the sensitive attachment visibility state, since showing text when not necessary is less dangerous than for images. (Possibly a preference for this in the future?) Closes #55
41 lines
1.0 KiB
Swift
41 lines
1.0 KiB
Swift
//
|
|
// StatusState.swift
|
|
// Pachyderm
|
|
//
|
|
// Created by Shadowfacts on 11/24/19.
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public class StatusState: Equatable, Hashable {
|
|
public var collapsible: Bool?
|
|
public var collapsed: Bool?
|
|
|
|
public var unknown: Bool {
|
|
collapsible == nil || collapsed == nil
|
|
}
|
|
|
|
public init(collapsible: Bool?, collapsed: Bool?) {
|
|
self.collapsible = collapsible
|
|
self.collapsed = collapsed
|
|
}
|
|
|
|
public func copy() -> StatusState {
|
|
return StatusState(collapsible: self.collapsible, collapsed: self.collapsed)
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(collapsible)
|
|
hasher.combine(collapsed)
|
|
}
|
|
|
|
public static var unknown: StatusState {
|
|
StatusState(collapsible: nil, collapsed: nil)
|
|
}
|
|
|
|
public static func == (lhs: StatusState, rhs: StatusState) -> Bool {
|
|
lhs.collapsible == rhs.collapsible && lhs.collapsed == rhs.collapsed
|
|
}
|
|
}
|