mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Update following review.
This commit is contained in:
@@ -29,18 +29,18 @@ extension TemplateSimpleScreenPromptType: Identifiable, CaseIterable {
|
||||
var title: String {
|
||||
switch self {
|
||||
case .regular:
|
||||
return "Enable this feature?"
|
||||
return VectorL10n.roomCreationMakePublicPromptTitle
|
||||
case .upgrade:
|
||||
return "Upgrade this feature?"
|
||||
return VectorL10n.roomDetailsHistorySectionPromptTitle
|
||||
}
|
||||
}
|
||||
|
||||
var imageName: String {
|
||||
var image: ImageAsset {
|
||||
switch self {
|
||||
case .regular:
|
||||
return "person.circle"
|
||||
return Asset.Images.appSymbol
|
||||
case .upgrade:
|
||||
return "arrowshape.zigzag.forward"
|
||||
return Asset.Images.keyVerificationSuccessShield
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-12
@@ -18,8 +18,8 @@ import SwiftUI
|
||||
|
||||
@available(iOS 14, *)
|
||||
typealias TemplateSimpleScreenViewModelType = StateStoreViewModel<TemplateSimpleScreenViewState,
|
||||
TemplateSimpleScreenStateAction,
|
||||
TemplateSimpleScreenViewAction>
|
||||
TemplateSimpleScreenStateAction,
|
||||
TemplateSimpleScreenViewAction>
|
||||
@available(iOS 14, *)
|
||||
class TemplateSimpleScreenViewModel: TemplateSimpleScreenViewModelType, TemplateSimpleScreenViewModelProtocol {
|
||||
|
||||
@@ -42,9 +42,9 @@ class TemplateSimpleScreenViewModel: TemplateSimpleScreenViewModelType, Template
|
||||
override func process(viewAction: TemplateSimpleScreenViewAction) {
|
||||
switch viewAction {
|
||||
case .accept:
|
||||
accept()
|
||||
completion?(.accept)
|
||||
case .cancel:
|
||||
cancel()
|
||||
completion?(.cancel)
|
||||
case .incrementCount, .decrementCount:
|
||||
dispatch(action: .viewAction(viewAction))
|
||||
}
|
||||
@@ -64,12 +64,4 @@ class TemplateSimpleScreenViewModel: TemplateSimpleScreenViewModelType, Template
|
||||
}
|
||||
UILog.debug("[TemplateSimpleScreenViewModel] reducer with action \(action) produced state: \(state)")
|
||||
}
|
||||
|
||||
private func accept() {
|
||||
completion?(.accept)
|
||||
}
|
||||
|
||||
private func cancel() {
|
||||
completion?(.cancel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,26 @@ struct TemplateSimpleScreen: View {
|
||||
|
||||
@ObservedObject var viewModel: TemplateSimpleScreenViewModel.Context
|
||||
|
||||
// MARK: Views
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
ScrollView(showsIndicators: false) {
|
||||
mainContent
|
||||
.padding(.top, 50)
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
}
|
||||
|
||||
buttons
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom > 0 ? 0 : 16)
|
||||
}
|
||||
}
|
||||
.background(theme.colors.background.ignoresSafeArea())
|
||||
.accentColor(theme.colors.accent)
|
||||
}
|
||||
|
||||
/// The main content of the view to be shown in a scroll view.
|
||||
var mainContent: some View {
|
||||
VStack(spacing: 36) {
|
||||
@@ -42,7 +62,7 @@ struct TemplateSimpleScreen: View {
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
.accessibilityIdentifier("title")
|
||||
|
||||
Image(systemName: viewModel.viewState.promptType.imageName)
|
||||
Image(viewModel.viewState.promptType.image.name)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width:100)
|
||||
@@ -80,24 +100,6 @@ struct TemplateSimpleScreen: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
ScrollView(showsIndicators: false) {
|
||||
mainContent
|
||||
.padding(.top, 50)
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
}
|
||||
|
||||
buttons
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
.padding(.bottom, geometry.safeAreaInsets.bottom > 0 ? 0 : 16)
|
||||
}
|
||||
}
|
||||
.background(theme.colors.background.ignoresSafeArea())
|
||||
.accentColor(theme.colors.accent)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
Reference in New Issue
Block a user