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

conditionally display memo warning for non-usdc #184

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading