Skip to content

Commit

Permalink
add whats new logic after user login
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepanokdev committed Oct 23, 2023
1 parent 05f51ac commit c79a4cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
27 changes: 24 additions & 3 deletions OpenEdX/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,30 @@ public class Router: AuthorizationRouter,

public func showMainScreen() {
showToolBar()
let controller = UIHostingController(rootView: MainScreenView())
navigationController.setViewControllers([controller], animated: true)
}
let viewModel = WhatsNewViewModel(router: Container.shared.resolve(WhatsNewRouter.self)!)
let whatsNew = WhatsNewView(viewModel: viewModel)
let storage = Container.shared.resolve(AppStorage.self)!
let showWhatsNew = viewModel.shouldShowWhatsNew(savedVersion: storage.whatsNewVersion)

if showWhatsNew {
if let jsonVersion = viewModel.getVersion() {
storage.whatsNewVersion = jsonVersion
}
let controller = UIHostingController(rootView: whatsNew)
navigationController.viewControllers = [controller]
navigationController.setViewControllers([controller], animated: true)
} else {
let controller = UIHostingController(rootView: MainScreenView())
navigationController.viewControllers = [controller]
navigationController.setViewControllers([controller], animated: true)
}
}

// public func showMainScreen() {
// showToolBar()
// let controller = UIHostingController(rootView: MainScreenView())
// navigationController.setViewControllers([controller], animated: true)
// }

public func showLoginScreen() {
let view = SignInView(viewModel: Container.shared.resolve(SignInViewModel.self)!)
Expand Down
2 changes: 1 addition & 1 deletion WhatsNew/WhatsNew/Data/WhatsNew.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"version": "1.4.1",
"version": "1.6.2",
"messages": [
{
"image": "image1_1.0",
Expand Down

0 comments on commit c79a4cd

Please sign in to comment.