Tusker/Tusker/Screens/Compose/ComposeUIState.swift

56 lines
1.3 KiB
Swift

//
// ComposeUIState.swift
// Tusker
//
// Created by Shadowfacts on 8/24/20.
// Copyright © 2020 Shadowfacts. All rights reserved.
//
import SwiftUI
protocol ComposeUIStateDelegate: class {
var assetPickerDelegate: AssetPickerViewControllerDelegate? { get }
func dismissCompose()
func presentAssetPickerSheet()
func presentComposeDrawing()
func keyboardWillShow(accessoryView: UIView, notification: Notification)
func keyboardWillHide(accessoryView: UIView, notification: Notification)
func keyboardDidHide(accessoryView: UIView, notification: Notification)
}
class ComposeUIState: ObservableObject {
weak var delegate: ComposeUIStateDelegate?
@Published var draft: Draft
@Published var isShowingSaveDraftSheet = false
@Published var attachmentsMissingDescriptions = Set<UUID>()
@Published var autocompleteState: AutocompleteState? = nil
var composeDrawingMode: ComposeDrawingMode?
weak var autocompleteHandler: ComposeAutocompleteHandler?
init(draft: Draft) {
self.draft = draft
}
}
extension ComposeUIState {
enum ComposeDrawingMode {
case createNew
case edit(id: UUID)
}
}
extension ComposeUIState {
enum AutocompleteState {
case mention(String)
case emoji(String)
case hashtag(String)
}
}