Skip to content

Commit

Permalink
fix: fixup after rebasing with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Nov 22, 2023
1 parent 7226877 commit 38cbec7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions Core/Core/Configuration/Config/FeaturesConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
1 change: 0 additions & 1 deletion Discovery/Discovery/Presentation/DiscoveryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions OpenEdX/RouteController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions OpenEdX/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 38cbec7

Please sign in to comment.