Add Screen suffix to all screens. (#125)

This commit is contained in:
Doug
2022-06-30 16:48:46 +01:00
committed by GitHub
parent 83a25d5501
commit 266ca656fc
20 changed files with 141 additions and 136 deletions
@@ -48,7 +48,7 @@ final class BugReportCoordinator: Coordinator, Presentable {
let viewModel = BugReportViewModel(bugReportService: parameters.bugReportService,
screenshot: parameters.screenshot)
let view = BugReport(context: viewModel.context)
let view = BugReportScreen(context: viewModel.context)
bugReportViewModel = viewModel
bugReportHostingController = UIHostingController(rootView: view)
@@ -16,7 +16,7 @@
import SwiftUI
struct BugReport: View {
struct BugReportScreen: View {
// MARK: Private
@@ -139,7 +139,7 @@ struct BugReport_Previews: PreviewProvider {
@ViewBuilder
static var body: some View {
let viewModel = BugReportViewModel(bugReportService: MockBugReportService(), screenshot: Asset.Images.appLogo.image)
BugReport(context: viewModel.context)
BugReportScreen(context: viewModel.context)
.previewInterfaceOrientation(.portrait)
}
}
@@ -159,22 +159,18 @@ struct MessageComposerTextField_Previews: PreviewProvider {
@ViewBuilder
static var body: some View {
VStack {
PreviewWrapper()
PlaceholderPreviewWrapper()
PreviewWrapper(text: "123")
PreviewWrapper(text: "")
}
}
struct PreviewWrapper: View {
@State(initialValue: "123") var text: String
var body: some View {
MessageComposerTextField(placeholder: "Placeholder", text: $text, maxHeight: 300)
@State var text: String
init(text: String) {
_text = .init(initialValue: text)
}
}
struct PlaceholderPreviewWrapper: View {
@State(initialValue: "") var text: String
var body: some View {
MessageComposerTextField(placeholder: "Placeholder", text: $text, maxHeight: 300)
}
@@ -51,7 +51,7 @@ final class SettingsCoordinator: Coordinator, Presentable {
self.parameters = parameters
let viewModel = SettingsViewModel()
let view = Settings(context: viewModel.context)
let view = SettingsScreen(context: viewModel.context)
settingsViewModel = viewModel
settingsHostingController = UIHostingController(rootView: view)
@@ -16,7 +16,7 @@
import SwiftUI
struct Settings: View {
struct SettingsScreen: View {
// MARK: Private
@@ -128,7 +128,7 @@ struct Settings_Previews: PreviewProvider {
@ViewBuilder
static var body: some View {
let viewModel = SettingsViewModel()
Settings(context: viewModel.context)
SettingsScreen(context: viewModel.context)
.previewInterfaceOrientation(.portrait)
}
}
@@ -49,12 +49,12 @@ struct SplashScreen: View {
HStack(alignment: .top, spacing: 0) {
// Add a hidden page at the start of the carousel duplicating the content of the last page
SplashScreenPage(content: context.viewState.content[pageCount - 1])
SplashScreenPageView(content: context.viewState.content[pageCount - 1])
.frame(width: geometry.size.width)
.accessibilityIdentifier("hiddenPage")
ForEach(0..<pageCount, id: \.self) { index in
SplashScreenPage(content: context.viewState.content[index])
SplashScreenPageView(content: context.viewState.content[index])
.frame(width: geometry.size.width)
}
@@ -16,7 +16,7 @@
import SwiftUI
struct SplashScreenPage: View {
struct SplashScreenPageView: View {
// MARK: - Properties
@@ -59,7 +59,7 @@ struct SplashScreenPage_Previews: PreviewProvider {
static let content = SplashScreenViewState().content
static var previews: some View {
ForEach(0..<content.count, id: \.self) { index in
SplashScreenPage(content: content[index])
SplashScreenPageView(content: content[index])
}
}
}
+2 -2
View File
@@ -62,9 +62,9 @@ struct MockScreen: Identifiable {
return LoginCoordinator(parameters: .init(navigationRouter: router,
homeserver: .mockUnsupported))
case .simpleRegular:
return TemplateSimpleScreenCoordinator(parameters: .init(promptType: .regular))
return TemplateCoordinator(parameters: .init(promptType: .regular))
case .simpleUpgrade:
return TemplateSimpleScreenCoordinator(parameters: .init(promptType: .upgrade))
return TemplateCoordinator(parameters: .init(promptType: .upgrade))
case .settings:
let router = NavigationRouter(navigationController: ElementNavigationController())
return SettingsCoordinator(parameters: .init(navigationRouter: router,