From 38cbec74fb323fe15be37a3ff096e3042bdf0df3 Mon Sep 17 00:00:00 2001 From: saeedbashir Date: Wed, 22 Nov 2023 10:36:02 +0500 Subject: [PATCH] fix: fixup after rebasing with develop --- .../Authorization/Presentation/Login/SignInView.swift | 7 +++---- Core/Core/Configuration/Config/FeaturesConfig.swift | 3 +++ Discovery/Discovery/Presentation/DiscoveryView.swift | 1 - OpenEdX/RouteController.swift | 3 +-- OpenEdX/Router.swift | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Authorization/Authorization/Presentation/Login/SignInView.swift b/Authorization/Authorization/Presentation/Login/SignInView.swift index d9d382458..f00527846 100644 --- a/Authorization/Authorization/Presentation/Login/SignInView.swift +++ b/Authorization/Authorization/Presentation/Login/SignInView.swift @@ -30,9 +30,8 @@ public struct SignInView: View { .resizable() .edgesIgnoringSafeArea(.top) }.frame(maxWidth: .infinity, maxHeight: 200) - - let config = Container.shared.resolve(Config.self)! - if config.startupScreenEnabled { + let config = Container.shared.resolve(ConfigProtocol.self) + if config?.features.startupScreenEnabled ?? false { VStack { Button(action: { viewModel.router.back() }, label: { CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) @@ -100,7 +99,7 @@ public struct SignInView: View { .fill(Theme.Colors.textInputStroke) ) HStack { - if !config.startupScreenEnabled { + if !(config?.features.startupScreenEnabled ?? true) { Button(AuthLocalization.SignIn.registerBtn) { viewModel.trackSignUpClicked() viewModel.router.showRegisterScreen() diff --git a/Core/Core/Configuration/Config/FeaturesConfig.swift b/Core/Core/Configuration/Config/FeaturesConfig.swift index eb6c6227f..eec9e9853 100644 --- a/Core/Core/Configuration/Config/FeaturesConfig.swift +++ b/Core/Core/Configuration/Config/FeaturesConfig.swift @@ -9,13 +9,16 @@ import Foundation private enum FeaturesKeys: String { case whatNewEnabled = "WHATS_NEW_ENABLED" + case startupScreenEnabled = "PRE_LOGIN_EXPERIENCE_ENABLED" } public class FeaturesConfig: NSObject { public var whatNewEnabled: Bool + public var startupScreenEnabled: Bool init(dictionary: [String: Any]) { whatNewEnabled = dictionary[FeaturesKeys.whatNewEnabled.rawValue] as? Bool ?? false + startupScreenEnabled = dictionary[FeaturesKeys.startupScreenEnabled.rawValue] as? Bool ?? false super.init() } } diff --git a/Discovery/Discovery/Presentation/DiscoveryView.swift b/Discovery/Discovery/Presentation/DiscoveryView.swift index 66592623a..f424944b9 100644 --- a/Discovery/Discovery/Presentation/DiscoveryView.swift +++ b/Discovery/Discovery/Presentation/DiscoveryView.swift @@ -16,7 +16,6 @@ public struct DiscoveryView: View { @State private var isRefreshing: Bool = false private var fromStartupScreen: Bool = false - private var router: DiscoveryRouter @Environment (\.isHorizontal) private var isHorizontal @Environment(\.presentationMode) private var presentationMode diff --git a/OpenEdX/RouteController.swift b/OpenEdX/RouteController.swift index b8a28c992..d86e7bb6d 100644 --- a/OpenEdX/RouteController.swift +++ b/OpenEdX/RouteController.swift @@ -42,8 +42,7 @@ class RouteController: UIViewController { } private func showStartupScreen() { - let config = Container.shared.resolve(Config.self)! - if config.startupScreenEnabled { + if let config = Container.shared.resolve(ConfigProtocol.self), config.features.startupScreenEnabled { let controller = UIHostingController( rootView: StartupView(viewModel: diContainer.resolve(StartupViewModel.self)!)) navigation.viewControllers = [controller] diff --git a/OpenEdX/Router.swift b/OpenEdX/Router.swift index 35cddf9ed..32b2f6828 100644 --- a/OpenEdX/Router.swift +++ b/OpenEdX/Router.swift @@ -89,8 +89,8 @@ public class Router: AuthorizationRouter, } public func showStartupScreen() { - let config = Container.shared.resolve(Config.self)! - if config.startupScreenEnabled { + + if let config = Container.shared.resolve(ConfigProtocol.self), config.features.startupScreenEnabled { let view = StartupView(viewModel: Container.shared.resolve(StartupViewModel.self)!) let controller = UIHostingController(rootView: view) navigationController.setViewControllers([controller], animated: true)