2018-08-31 02:30:19 +00:00
|
|
|
//
|
2023-03-07 15:14:35 +00:00
|
|
|
// Visibility.swift
|
|
|
|
// Pachyderm
|
2018-08-31 02:30:19 +00:00
|
|
|
//
|
2023-03-07 15:14:35 +00:00
|
|
|
// Created by Shadowfacts on 3/7/23.
|
2018-08-31 02:30:19 +00:00
|
|
|
//
|
|
|
|
|
2023-03-07 15:14:35 +00:00
|
|
|
import Foundation
|
2018-08-31 02:30:19 +00:00
|
|
|
|
2023-03-07 15:14:35 +00:00
|
|
|
public enum Visibility: String, Sendable, Codable, CaseIterable, Comparable {
|
|
|
|
case `public`
|
|
|
|
case unlisted
|
|
|
|
case `private`
|
|
|
|
case direct
|
2018-08-31 02:30:19 +00:00
|
|
|
|
2023-03-07 15:14:35 +00:00
|
|
|
public static func < (lhs: Visibility, rhs: Visibility) -> Bool {
|
|
|
|
switch (lhs, rhs) {
|
|
|
|
case (.direct, .public), (.private, .public), (.unlisted, .public):
|
|
|
|
return true
|
|
|
|
case (.direct, .unlisted), (.private, .unlisted):
|
|
|
|
return true
|
|
|
|
case (.direct, .private):
|
|
|
|
return true
|
|
|
|
default:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public extension Visibility {
|
2018-08-31 02:30:19 +00:00
|
|
|
var displayName: String {
|
|
|
|
switch self {
|
|
|
|
case .public:
|
|
|
|
return "Public"
|
|
|
|
case .unlisted:
|
|
|
|
return "Unlisted"
|
|
|
|
case .private:
|
|
|
|
return "Private"
|
|
|
|
case .direct:
|
|
|
|
return "Direct"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-28 03:21:08 +00:00
|
|
|
var subtitle: String {
|
|
|
|
switch self {
|
|
|
|
case .public:
|
|
|
|
return "Everyone"
|
|
|
|
case .unlisted:
|
|
|
|
return "Hidden from public timelines"
|
|
|
|
case .private:
|
|
|
|
return "Followers only"
|
|
|
|
case .direct:
|
|
|
|
return "Mentioned users only"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-14 00:53:17 +00:00
|
|
|
var imageName: String {
|
2019-06-13 19:38:40 +00:00
|
|
|
switch self {
|
|
|
|
case .public:
|
2019-06-14 00:53:17 +00:00
|
|
|
return "globe"
|
2019-06-13 19:38:40 +00:00
|
|
|
case .unlisted:
|
2019-06-14 00:53:17 +00:00
|
|
|
return "lock.open.fill"
|
2019-06-13 19:38:40 +00:00
|
|
|
case .private:
|
2019-06-14 00:53:17 +00:00
|
|
|
return "lock.fill"
|
2019-06-13 19:38:40 +00:00
|
|
|
case .direct:
|
2019-06-14 00:53:17 +00:00
|
|
|
return "envelope.fill"
|
2019-06-13 19:38:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-17 03:00:39 +00:00
|
|
|
var unfilledImageName: String {
|
|
|
|
switch self {
|
|
|
|
case .public:
|
|
|
|
return "globe"
|
|
|
|
case .unlisted:
|
|
|
|
return "lock.open"
|
|
|
|
case .private:
|
|
|
|
return "lock"
|
|
|
|
case .direct:
|
|
|
|
return "envelope"
|
|
|
|
}
|
|
|
|
}
|
2022-11-05 16:20:30 +00:00
|
|
|
}
|