diff --git a/Authorization/Authorization/Presentation/Login/SignInView.swift b/Authorization/Authorization/Presentation/Login/SignInView.swift index 731c9385e..d9d382458 100644 --- a/Authorization/Authorization/Presentation/Login/SignInView.swift +++ b/Authorization/Authorization/Presentation/Login/SignInView.swift @@ -7,6 +7,7 @@ import SwiftUI import Core +import Swinject public struct SignInView: View { @@ -30,17 +31,20 @@ public struct SignInView: View { .edgesIgnoringSafeArea(.top) }.frame(maxWidth: .infinity, maxHeight: 200) - VStack { - Button(action: { viewModel.router.back() }, label: { - CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) - .backButtonStyle(color: .white) - }) - .foregroundColor(Theme.Colors.styledButtonText) - .padding(.leading, isHorizontal ? 48 : 0) - .padding(.top, 11) - - }.frame(maxWidth: .infinity, alignment: .topLeading) - .padding(.top, isHorizontal ? 20 : 0) + let config = Container.shared.resolve(Config.self)! + if config.startupScreenEnabled { + VStack { + Button(action: { viewModel.router.back() }, label: { + CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) + .backButtonStyle(color: .white) + }) + .foregroundColor(Theme.Colors.styledButtonText) + .padding(.leading, isHorizontal ? 48 : 0) + .padding(.top, 11) + + }.frame(maxWidth: .infinity, alignment: .topLeading) + .padding(.top, isHorizontal ? 20 : 0) + } VStack(alignment: .center) { CoreAssets.appLogo.swiftUIImage @@ -95,12 +99,22 @@ public struct SignInView: View { .stroke(lineWidth: 1) .fill(Theme.Colors.textInputStroke) ) - + HStack { + if !config.startupScreenEnabled { + Button(AuthLocalization.SignIn.registerBtn) { + viewModel.trackSignUpClicked() + viewModel.router.showRegisterScreen() + }.foregroundColor(Theme.Colors.accentColor) + + Spacer() + } + Button(AuthLocalization.SignIn.forgotPassBtn) { viewModel.trackForgotPasswordClicked() viewModel.router.showForgotPasswordScreen() }.foregroundColor(Theme.Colors.accentColor) - .padding(.top, 0) + .padding(.top, 0) + } if viewModel.isShowProgress { HStack(alignment: .center) { diff --git a/Core/Core/Configuration/Config.swift b/Core/Core/Configuration/Config.swift index 8263f5c16..6514b3c11 100644 --- a/Core/Core/Configuration/Config.swift +++ b/Core/Core/Configuration/Config.swift @@ -28,6 +28,7 @@ public class Config { "itms-apps://itunes.apple.com/app/id\(appStoreId)?mt=8" } public let whatsNewEnabled: Bool = false + public let startupScreenEnabled: Bool = false public init(baseURL: String, oAuthClientId: String) { guard let url = URL(string: baseURL) else { diff --git a/OpenEdX/RouteController.swift b/OpenEdX/RouteController.swift index a58fdc900..1b9586e0b 100644 --- a/OpenEdX/RouteController.swift +++ b/OpenEdX/RouteController.swift @@ -42,10 +42,19 @@ class RouteController: UIViewController { } private func showStartupScreen() { - let controller = UIHostingController( - rootView: StartupView(viewModel: diContainer.resolve(StartupViewModel.self)!)) - navigation.viewControllers = [controller] - present(navigation, animated: false) + let config = Container.shared.resolve(Config.self)! + if config.startupScreenEnabled { + let controller = UIHostingController( + rootView: StartupView(viewModel: diContainer.resolve(StartupViewModel.self)!)) + navigation.viewControllers = [controller] + present(navigation, animated: false) + } else { + let controller = UIHostingController( + rootView: SignInView(viewModel: diContainer.resolve(SignInViewModel.self)!) + ) + navigation.viewControllers = [controller] + present(navigation, animated: false) + } } private func showMainOrWhatsNewScreen() { diff --git a/OpenEdX/Router.swift b/OpenEdX/Router.swift index 8ccb10385..1e87b9bed 100644 --- a/OpenEdX/Router.swift +++ b/OpenEdX/Router.swift @@ -89,10 +89,16 @@ public class Router: AuthorizationRouter, } public func showStartupScreen() { - let view = StartupView(viewModel: Container.shared.resolve(StartupViewModel.self)!) - - let controller = UIHostingController(rootView: view) - navigationController.setViewControllers([controller], animated: true) + let config = Container.shared.resolve(Config.self)! + if config.startupScreenEnabled { + let view = StartupView(viewModel: Container.shared.resolve(StartupViewModel.self)!) + let controller = UIHostingController(rootView: view) + navigationController.setViewControllers([controller], animated: true) + } else { + let view = SignInView(viewModel: Container.shared.resolve(SignInViewModel.self)!) + let controller = UIHostingController(rootView: view) + navigationController.setViewControllers([controller], animated: false) + } } public func presentAlert(