Skip to content

Commit

Permalink
conditionally display warning for non-usdc (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Aug 21, 2024
1 parent e5da267 commit 3d91c71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class dydxTransferOutViewPresenter: HostedViewPresenter<dydxTransferOutViewModel

viewModel?.addressInput?.value = transferInput.address

viewModel?.memoBox?.shouldDisplayWarningWhenEmpty = transferInput.token != dydxTokenConstants.usdcTokenKey
viewModel?.memoBox?.value = transferInput.memo
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import dydxFormatter

public class MemoBoxModel: PlatformTextInputViewModel {
@Published public var pasteAction: (() -> Void)?
@Published public var shouldDisplayWarningWhenEmpty: Bool = false

public init(onEdited: ((String?) -> Void)?) {
super.init(label: DataLocalizer.localize(path: "APP.GENERAL.MEMO"),
Expand All @@ -20,7 +21,7 @@ public class MemoBoxModel: PlatformTextInputViewModel {
}

private var memoWarning: InlineAlertViewModel? {
guard value?.isEmpty != false else { return nil }
guard value?.isEmpty != false && shouldDisplayWarningWhenEmpty else { return nil }
return InlineAlertViewModel(.init(title: nil,
body: DataLocalizer.localize(path: "ERRORS.TRANSFER_MODAL.TRANSFER_WITHOUT_MEMO"),
level: .warning))
Expand Down

0 comments on commit 3d91c71

Please sign in to comment.