forked from shadowfacts/Tusker
82 lines
1.8 KiB
Swift
82 lines
1.8 KiB
Swift
//
|
|
// Visibility+String.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 8/29/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import Pachyderm
|
|
import UIKit
|
|
|
|
extension Status.Visibility {
|
|
|
|
var displayName: String {
|
|
switch self {
|
|
case .public:
|
|
return "Public"
|
|
case .unlisted:
|
|
return "Unlisted"
|
|
case .private:
|
|
return "Private"
|
|
case .direct:
|
|
return "Direct"
|
|
}
|
|
}
|
|
|
|
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"
|
|
}
|
|
}
|
|
|
|
var imageName: String {
|
|
switch self {
|
|
case .public:
|
|
return "globe"
|
|
case .unlisted:
|
|
return "lock.open.fill"
|
|
case .private:
|
|
return "lock.fill"
|
|
case .direct:
|
|
return "envelope.fill"
|
|
}
|
|
}
|
|
|
|
var unfilledImageName: String {
|
|
switch self {
|
|
case .public:
|
|
return "globe"
|
|
case .unlisted:
|
|
return "lock.open"
|
|
case .private:
|
|
return "lock"
|
|
case .direct:
|
|
return "envelope"
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
extension Status.Visibility: Comparable {
|
|
public static func < (lhs: Pachyderm.Status.Visibility, rhs: Pachyderm.Status.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
|
|
}
|
|
}
|
|
}
|