-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
390 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
dydx/dydxPresenters/dydxPresenters/_v4/SimpleUI/FirstTime/dydxFirstTimeViewBuilder.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// dydxFirstTimeViewBuilder.swift | ||
// dydxPresenters | ||
// | ||
// Created by Rui Huang on 24/01/2025. | ||
// | ||
|
||
import Utilities | ||
import dydxViews | ||
import PlatformParticles | ||
import RoutingKit | ||
import ParticlesKit | ||
import PlatformUI | ||
|
||
public class dydxFirstTimeViewBuilder: NSObject, ObjectBuilderProtocol { | ||
public func build<T>() -> T? { | ||
let presenter = dydxFirstTimeViewPresenter() | ||
let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() | ||
return dydxFirstTimeViewController(presenter: presenter, view: view, configuration: .default) as? T | ||
} | ||
} | ||
|
||
class dydxFirstTimeViewController: HostingViewController<PlatformView, dydxFirstTimeViewModel> { | ||
override public func arrive(to request: RoutingRequest?, animated: Bool) -> Bool { | ||
if request?.path == "<Replace>" { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
guard let presenter = presenter as? dydxFirstTimeViewPresenter else { | ||
return | ||
} | ||
|
||
presenter.showWelecomScreen() | ||
} | ||
} | ||
|
||
protocol dydxFirstTimeViewPresenterProtocol: HostedViewPresenterProtocol { | ||
var viewModel: dydxFirstTimeViewModel? { get } | ||
} | ||
|
||
class dydxFirstTimeViewPresenter: HostedViewPresenter<dydxFirstTimeViewModel>, dydxFirstTimeViewPresenterProtocol { | ||
|
||
private var started = false | ||
|
||
override init() { | ||
super.init() | ||
|
||
viewModel = dydxFirstTimeViewModel() | ||
} | ||
|
||
func showWelecomScreen() { | ||
if !started { | ||
started = true | ||
let params = ["mode": "welcome"] | ||
Router.shared?.navigate(to: RoutingRequest(path: "/onboard", params: params), animated: true, completion: nil) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.