mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
WIP
This commit is contained in:
+28
@@ -15,11 +15,39 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import WysiwygComposer
|
||||
|
||||
typealias ComposerLinkActionViewModelType = StateStoreViewModel<ComposerLinkActionViewState, ComposerLinkActionViewAction>
|
||||
|
||||
final class ComposerLinkActionViewModel: ComposerLinkActionViewModelType, ComposerLinkActionViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
// MARK: Public
|
||||
|
||||
var callback: ((ComposerLinkActionViewModelResult) -> Void)?
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
init(from linkAction: LinkAction) {
|
||||
let initialViewState: ComposerLinkActionViewState
|
||||
// TODO: Add translations
|
||||
switch linkAction {
|
||||
case .edit:
|
||||
initialViewState = .init(title: "Edit Link")
|
||||
case .createWithText, .create:
|
||||
initialViewState = .init(title: "Create a Link")
|
||||
}
|
||||
|
||||
super.init(initialViewState: initialViewState)
|
||||
}
|
||||
|
||||
override func process(viewAction: ComposerLinkActionViewAction) {
|
||||
switch viewAction {
|
||||
case .cancel:
|
||||
callback?(.cancel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user