Skip to content

Commit

Permalink
Fix set max amount when switching another wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhalang committed May 14, 2021
1 parent 580e7d9 commit cf0dc52
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ui/send_page.go
Expand Up @@ -108,6 +108,8 @@ type sendPage struct {

txAuthorErrChan chan error
broadcastErrChan chan error

walletSelected int
}

func (win *Window) SendPage(common pageCommon) layout.Widget {
Expand Down Expand Up @@ -141,6 +143,8 @@ func (win *Window) SendPage(common pageCommon) layout.Widget {
txAuthorErrChan: make(chan error),
}

pg.walletSelected = common.wallAcctSelector.selectedSendWallet

pg.accountSwitch = common.theme.SwitchButtonText([]decredmaterial.SwitchItem{{Text: "Address"}, {Text: "My account"}})

pg.balanceAfterSendValue = "- DCR"
Expand Down Expand Up @@ -1141,6 +1145,11 @@ func (pg *sendPage) Handle(c pageCommon) {
pg.leftAmountEditor.SetError(pg.amountErrorText)
}

if pg.walletSelected != c.wallAcctSelector.selectedSendWallet {
pg.shouldInitializeTxAuthor = true
pg.walletSelected = c.wallAcctSelector.selectedSendWallet
}

if pg.shouldInitializeTxAuthor {
pg.shouldInitializeTxAuthor = false
pg.leftAmountEditor.Editor.SetText("")
Expand Down

0 comments on commit cf0dc52

Please sign in to comment.