IceCubesApp/Packages/Status/Sources/Status/Editor/StatusEditorViewModelMode.swift

54 lines
1.3 KiB
Swift
Raw Normal View History

2022-12-27 12:38:10 +00:00
import Models
2023-01-15 15:39:08 +00:00
import UIKit
2022-12-27 12:38:10 +00:00
extension StatusEditorViewModel {
public enum Mode {
case replyTo(status: Status)
case new(vivibilty: Visibility)
2022-12-27 12:38:10 +00:00
case edit(status: Status)
case quote(status: Status)
2023-01-04 17:37:58 +00:00
case mention(account: Account, visibility: Visibility)
2023-01-15 15:39:08 +00:00
case shareExtension(items: [NSItemProvider])
var isInShareExtension: Bool {
switch self {
case .shareExtension:
return true
default:
return false
}
}
2022-12-27 12:38:10 +00:00
2023-01-03 19:36:57 +00:00
var isEditing: Bool {
switch self {
case .edit:
return true
default:
return false
}
}
2022-12-27 12:38:10 +00:00
var replyToStatus: Status? {
switch self {
case let .replyTo(status):
return status
default:
return nil
}
}
var title: String {
switch self {
2023-01-15 15:39:08 +00:00
case .new, .mention, .shareExtension:
2022-12-27 12:38:10 +00:00
return "New Post"
case .edit:
2023-01-05 17:54:18 +00:00
return "Editing your post"
2022-12-27 12:38:10 +00:00
case let .replyTo(status):
return "Replying to \(status.reblog?.account.displayNameWithoutEmojis ?? status.account.displayNameWithoutEmojis)"
2022-12-27 12:38:10 +00:00
case let .quote(status):
return "Quote of \(status.reblog?.account.displayNameWithoutEmojis ?? status.account.displayNameWithoutEmojis)"
2022-12-27 12:38:10 +00:00
}
}
}
}