Skip to content

Commit

Permalink
Bump Abacus and show transfer error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang committed Nov 9, 2023
1 parent b5d65b3 commit 5a12297
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 78 deletions.
4 changes: 2 additions & 2 deletions dydx/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Abacus (1.0.20)
- Abacus (1.0.24)
- Amplitude-iOS (4.10.0)
- AppsFlyerFramework (6.12.2):
- AppsFlyerFramework/Main (= 6.12.2)
Expand Down Expand Up @@ -379,7 +379,7 @@ CHECKOUT OPTIONS:
:http: https://ios-releases.fullstory.com/fullstory-1.29.0-xcframework.tar.gz

SPEC CHECKSUMS:
Abacus: 521cdee506e6efad5c3d04eb12b370466b10bbd1
Abacus: fee4da3726a276a18de4eb2d88b807217c547071
Amplitude-iOS: 7d8cdc3408ba35c2e68368fc7c692cd104606b94
AppsFlyerFramework: 6eb4d89d2eb9a6632317f1055b359d9fd85fd5ff
Atributika: 0eabae2cc37999e79c5b94f60213642946991b1c
Expand Down
6 changes: 3 additions & 3 deletions dydx/Pods/Local Podspecs/abacus.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dydx/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 65 additions & 65 deletions dydx/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ class dydxValidationViewPresenter: HostedViewPresenter<dydxValidationViewModel>,
Publishers.CombineLatest(
AbacusStateManager.shared.state.validationErrors,
AbacusStateManager.shared.state.transferInput
.map(\.errors)
.removeDuplicates()
)
.sink { [weak self] validationErrors, transferErrors in
self?.update(errors: validationErrors, transferErrors: transferErrors)
.sink { [weak self] validationErrors, transferInput in
self?.update(errors: validationErrors, transferInput: transferInput)
}
.store(in: &subscriptions)

Expand All @@ -71,7 +70,9 @@ class dydxValidationViewPresenter: HostedViewPresenter<dydxValidationViewModel>,
receiptPresenter.stop()
}

private func update(errors: [ValidationError], transferErrors: String?) {
private func update(errors: [ValidationError], transferInput: TransferInput?) {
let transferErrors = transferInput?.errors
let errorMessage = transferInput?.errorMessage
let firstBlockingError = errors.first { $0.type == ErrorType.error }
let firstWarning = errors.first { $0.type == ErrorType.warning }
if let firstBlockingError = firstBlockingError {
Expand All @@ -91,7 +92,7 @@ class dydxValidationViewPresenter: HostedViewPresenter<dydxValidationViewModel>,
} else if let transferErrors = transferErrors, transferErrors.count > 0 {
viewModel?.title = DataLocalizer.localize(path: "ERRORS.GENERAL.SOMETHING_WENT_WRONG_WITH_MESSAGE",
params: ["ERROR_MESSAGE": ""])
viewModel?.text = transferErrors
viewModel?.text = errorMessage ?? transferErrors
viewModel?.errorType = .error
if viewModel?.state == .hide {
viewModel?.state = .showError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ class dydxTransferInputCtaButtonViewPresenter: HostedViewPresenter<dydxTradeInpu
private func update(transferInput: TransferInput, tradeErrors: [ValidationError]) {
if hasValidSize(transferInput: transferInput) {
let firstBlockingError = tradeErrors.first { $0.type == ErrorType.required || $0.type == ErrorType.error }
let transferError = transferInput.errors
if let firstBlockingError = firstBlockingError {
if (transferType == .deposit || transferType == .withdrawal) && transferInput.requestPayload == nil {
viewModel?.ctaButtonState = .thinking
} else {
viewModel?.ctaButtonState = .disabled(firstBlockingError.resources.action?.localizedString)
}
} else if transferError != nil {
viewModel?.ctaButtonState = .disabled(DataLocalizer.localize(path: "APP.GENERAL.ERROR"))
} else {
switch transferType {
case .deposit:
Expand Down
2 changes: 1 addition & 1 deletion podspecs/Abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Abacus'
spec.version = '1.0.20'
spec.version = '1.0.24'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :git => "[email protected]:dydxprotocol/v4-abacus.git", :tag => "v#{spec.version}" }
spec.authors = ''
Expand Down

0 comments on commit 5a12297

Please sign in to comment.