Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOB-456 : integrate abacus validation error with button states #145

Conversation

mike-dydx
Copy link
Contributor

Links (dYdX Internal Use Only)

Linear Ticket: MOB-456 : integrate abacus validation error with button states

Figma Design: https://www.figma.com/file/mKevZOfE9nj6MZpiolKYW1/dYdX-%E2%80%BA-Mobile?type=design&node-id=5621-14141&mode=design&t=8620ZeK9v5G9SIV4-4


Description / Intuition

  • fixes issue where manually inputting custom size value via keyboard was getting overwritten
  • adds inline error display to custom limit price area
  • uses validation errors instead of custom error displays

Before/After Screenshots or Videos

Before After
Simulator.Screen.Recording.-.iPhone.15.-.2024-04-22.at.20.19.07.mp4
Simulator.Screen.Recording.-.iPhone.15.-.2024-04-22.at.20.15.04.mp4

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring or Technical Debt
  • Documentation update
  • Other (please describe: )

Copy link

linear bot commented Apr 23, 2024

@mike-dydx mike-dydx requested a review from ruixhuang April 23, 2024 00:22
@mike-dydx mike-dydx force-pushed the mike/mob-456-integrate-abacus-validation-error-with-button-states branch from 4e99e55 to 5ccdcab Compare April 23, 2024 00:26
@@ -171,6 +165,8 @@ private class dydxTakeProfitStopLossViewPresenter: HostedViewPresenter<dydxTakeP
viewModel?.takeProfitStopLossInputAreaViewModel?.stopLossPriceInputViewModel?.value = dydxFormatter.shared.raw(number: triggerOrdersInput?.stopLossOrder?.price?.triggerPrice?.doubleValue, digits: 2)
viewModel?.takeProfitStopLossInputAreaViewModel?.lossInputViewModel?.value = dydxFormatter.shared.raw(number: triggerOrdersInput?.stopLossOrder?.price?.usdcDiff?.doubleValue, digits: 2)

viewModel?.customAmountViewModel?.value = triggerOrdersInput?.size?.doubleValue.magnitude.stringValue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes manual input issue mentioned in description

@@ -187,7 +183,8 @@ private class dydxTakeProfitStopLossViewPresenter: HostedViewPresenter<dydxTakeP
}

if let error = errors.first {
viewModel?.submissionReadiness = .fixErrors(cta: error.resources.action?.localized)
let errorCta = error.resources.action?.localized ?? DataLocalizer.shared?.localize(path: error.resources.action?.stringKey ?? "", params: nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extension to use:

extension ErrorString { var localizedString: String? { localized ?? DataLocalizer.localize(path: stringKey, params: params?.dictionary) } }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed d8051ac

@@ -295,6 +292,7 @@ private class dydxTakeProfitStopLossViewPresenter: HostedViewPresenter<dydxTakeP
AbacusStateManager.shared.triggerOrders(input: $0, type: .stoplossusdcdiff)
}
viewModel.customAmountViewModel?.onEdited = {
print("mmm: custom amount edited \($0)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete?

Copy link
Contributor Author

@mike-dydx mike-dydx Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll do a clean up PR at the end of the project. There's many other print statements i need to get rid of. Omitted anyways d8051ac

@mike-dydx mike-dydx requested a review from ruixhuang April 23, 2024 17:28
@mike-dydx mike-dydx force-pushed the mike/mob-456-integrate-abacus-validation-error-with-button-states branch from 260a94a to d8051ac Compare April 23, 2024 17:35
@mike-dydx mike-dydx merged commit 33ef2fb into develop Apr 23, 2024
2 checks passed
@mike-dydx mike-dydx deleted the mike/mob-456-integrate-abacus-validation-error-with-button-states branch April 23, 2024 17:59
mike-dydx added a commit that referenced this pull request Aug 20, 2024
* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* add validation error handling

* use localized string extension for validation error
mike-dydx added a commit that referenced this pull request Aug 21, 2024
* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* add validation error handling

* use localized string extension for validation error
mike-dydx added a commit that referenced this pull request Aug 21, 2024
* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* bump 1.6.36 -> 1.6.38

* some ui

* add label accessory to platform input, split out input views into view models

* clean up

* add cta button

* hook up button and button states

* abacus?

* clean up

* pause

* clean up

* pause

* fix keyboard, fix toggle clipping, fix trade input not scrollable

* clean up

* clean up

* add validation error handling

* use localized string extension for validation error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants