mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Simplify the screen templates
This commit is contained in:
committed by
Stefan Ceriu
parent
28c2490910
commit
6e5854abf9
+10
-10
@@ -26,22 +26,22 @@ class TemplateScreenViewModel: TemplateScreenViewModelType, TemplateScreenViewMo
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(promptType: TemplateScreenPromptType, initialCount: Int = 0) {
|
||||
super.init(initialViewState: TemplateScreenViewState(promptType: promptType, count: 0))
|
||||
init() {
|
||||
super.init(initialViewState: TemplateScreenViewState(title: "Template title",
|
||||
placeholder: "Enter something here",
|
||||
bindings: .init(composerText: "Initial composer text")))
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
override func process(viewAction: TemplateScreenViewAction) {
|
||||
MXLog.info("View model: received view action: \(viewAction)")
|
||||
|
||||
switch viewAction {
|
||||
case .accept:
|
||||
actionsSubject.send(.accept)
|
||||
case .cancel:
|
||||
actionsSubject.send(.cancel)
|
||||
case .incrementCount:
|
||||
state.count += 1
|
||||
case .decrementCount:
|
||||
state.count -= 1
|
||||
case .done:
|
||||
actionsSubject.send(.done)
|
||||
case .textChanged:
|
||||
MXLog.info("View model: composer text changed to: \(state.bindings.composerText)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user