mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 02:52:45 +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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
Reference in New Issue
Block a user