-
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.
CLI-638: iOS prediction markets UI (#226)
* add footer text when prediction markets is selected filter * presenting prediction markets notice * new `present_over_full_screen` presentation style * speed up animation, improve timing for trade input presentation * add checkbox * remove test code * touchups * change logic to display prediction markets notice --------- Co-authored-by: Mike <[email protected]>
- Loading branch information
Showing
17 changed files
with
330 additions
and
34 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
56 changes: 56 additions & 0 deletions
56
...dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxPredictionMarketsNoticeViewBuilder.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,56 @@ | ||
// | ||
// dydxPredictionMarketsNoticeViewBuilder.swift | ||
// dydxPresenters | ||
// | ||
// Created by Michael Maguire on 8/9/24. | ||
// | ||
|
||
import Utilities | ||
import dydxViews | ||
import PlatformParticles | ||
import RoutingKit | ||
import ParticlesKit | ||
import PlatformUI | ||
|
||
public class dydxPredictionMarketsNoticeViewBuilder: NSObject, ObjectBuilderProtocol { | ||
public func build<T>() -> T? { | ||
let presenter = dydxPredictionMarketsNoticeViewPresenter() | ||
let view = presenter.viewModel?.createView() ?? PlatformViewModel().createView() | ||
return dydxPredictionMarketsNoticeViewController(presenter: presenter, view: view, configuration: .default) as? T | ||
} | ||
} | ||
|
||
private class dydxPredictionMarketsNoticeViewController: HostingViewController<PlatformView, dydxPredictionMarketsNoticeViewModel> { | ||
override public func arrive(to request: RoutingRequest?, animated: Bool) -> Bool { | ||
if request?.path == "/trade/prediction_markets_notice" { | ||
return true | ||
} | ||
return false | ||
} | ||
} | ||
|
||
private protocol dydxPredictionMarketsNoticeViewPresenterProtocol: HostedViewPresenterProtocol { | ||
var viewModel: dydxPredictionMarketsNoticeViewModel? { get } | ||
} | ||
|
||
private class dydxPredictionMarketsNoticeViewPresenter: HostedViewPresenter<dydxPredictionMarketsNoticeViewModel>, dydxPredictionMarketsNoticeViewPresenterProtocol { | ||
|
||
fileprivate static var hidePredictionMarketsNotice: Bool { | ||
get { SettingsStore.shared?.value(forKey: dydxSettingsStoreKey.hidePredictionMarketsNoticeKey.rawValue) as? Bool ?? false } | ||
set { SettingsStore.shared?.setValue(newValue, forKey: dydxSettingsStoreKey.hidePredictionMarketsNoticeKey.rawValue) } | ||
} | ||
|
||
override init() { | ||
super.init() | ||
|
||
viewModel = dydxPredictionMarketsNoticeViewModel() | ||
viewModel?.continueAction = { | ||
Router.shared?.navigate(to: RoutingRequest(path: "/action/dismiss"), animated: true, completion: nil) | ||
} | ||
|
||
viewModel?.hidePredictionMarketsNotice = Self.hidePredictionMarketsNotice | ||
viewModel?.$hidePredictionMarketsNotice | ||
.sink { Self.hidePredictionMarketsNotice = $0 } | ||
.store(in: &subscriptions) | ||
} | ||
} |
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.