-
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.
MOB-240 : Trading Rewards hook in real data pt 2 (launch incentives) (#…
…94) * hook in new launch incentive properties * temp * integrate new abacus launch incentives fields * add background texture * use incentive points
- Loading branch information
Showing
8 changed files
with
99 additions
and
29 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
59 changes: 59 additions & 0 deletions
59
...esenters/_v4/Profile/TradingRewards/Components/dydxRewardsLaunchIncentivesPresenter.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,59 @@ | ||
// | ||
// dydxRewardsLaunchIncentivesPresenter.swift | ||
// dydxPresenters | ||
// | ||
// Created by Michael Maguire on 2/20/24. | ||
// | ||
|
||
import dydxViews | ||
import PlatformParticles | ||
import ParticlesKit | ||
import Combine | ||
import dydxStateManager | ||
import dydxFormatter | ||
import Utilities | ||
import Abacus | ||
import RoutingKit | ||
|
||
public protocol dydxRewardsLaunchIncentivesPresenterProtocol: HostedViewPresenterProtocol { | ||
var viewModel: dydxRewardsLaunchIncentivesViewModel? { get } | ||
} | ||
|
||
public class dydxRewardsLaunchIncentivesPresenter: HostedViewPresenter<dydxRewardsLaunchIncentivesViewModel>, dydxRewardsLaunchIncentivesPresenterProtocol { | ||
|
||
override init() { | ||
super.init() | ||
|
||
viewModel = dydxRewardsLaunchIncentivesViewModel() | ||
} | ||
|
||
public override func start() { | ||
super.start() | ||
|
||
Publishers.CombineLatest( | ||
AbacusStateManager.shared.state.account, | ||
AbacusStateManager.shared.state.launchIncentive) | ||
.sink { [weak self] (account, launchIncentive) in | ||
self?.update(currentSeason: launchIncentive?.currentSeason, seasonPointMap: account?.launchIncentivePoints?.points) | ||
|
||
} | ||
.store(in: &subscriptions) | ||
|
||
viewModel?.aboutAction = { | ||
Router.shared?.navigate(to: URL(string: "https://dydx.exchange/blog/v4-full-trading"), completion: nil) | ||
} | ||
|
||
viewModel?.leaderboardAction = { | ||
Router.shared?.navigate(to: URL(string: "https://community.chaoslabs.xyz/dydx-v4/risk/leaderboard"), completion: nil) | ||
} | ||
} | ||
|
||
private func update(currentSeason: String?, seasonPointMap: [String: LaunchIncentivePoint]?) { | ||
viewModel?.seasonOrdinal = currentSeason | ||
if let currentSeason, let incentivePoints = seasonPointMap?[currentSeason]?.incentivePoints { | ||
viewModel?.points = "\(incentivePoints)" | ||
} else { | ||
viewModel?.points = "--" | ||
} | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
dydx/dydxViews/dydxViews/Media.xcassets/texture.imageset/Contents.json
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,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "texture.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file not shown.
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