diff --git a/handlers/application/send.go b/handlers/application/send.go index 31b252c..814a6f9 100644 --- a/handlers/application/send.go +++ b/handlers/application/send.go @@ -836,3 +836,19 @@ func (h *MenuHandlers) TransactionInitiateSwap(ctx context.Context, sym string, res.FlagReset = append(res.FlagReset, flag_account_authorized, flag_swap_transaction) return res, nil } + + +// ClearTransactionTypeFlag resets the flag when a user goes back. +func (h *MenuHandlers) ClearTransactionTypeFlag(ctx context.Context, sym string, input []byte) (resource.Result, error) { + var res resource.Result + + flag_swap_transaction, _ := h.flagManager.GetFlag("flag_swap_transaction") + + inputStr := string(input) + if inputStr == "0" { + res.FlagReset = append(res.FlagReset, flag_swap_transaction) + return res, nil + } + + return res, nil +} diff --git a/handlers/local.go b/handlers/local.go index 4742041..836db72 100644 --- a/handlers/local.go +++ b/handlers/local.go @@ -138,6 +138,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService) ls.DbRs.AddLocalFunc("initiate_swap", appHandlers.InitiateSwap) ls.DbRs.AddLocalFunc("transaction_swap_preview", appHandlers.TransactionSwapPreview) ls.DbRs.AddLocalFunc("transaction_initiate_swap", appHandlers.TransactionInitiateSwap) + ls.DbRs.AddLocalFunc("clear_trans_type_flag", appHandlers.ClearTransactionTypeFlag) ls.first = appHandlers.Init diff --git a/services/registration/amount.vis b/services/registration/amount.vis index d4786ab..e576600 100644 --- a/services/registration/amount.vis +++ b/services/registration/amount.vis @@ -4,6 +4,8 @@ RELOAD max_amount MAP max_amount MOUT back 0 HALT +LOAD clear_trans_type_flag 6 +RELOAD clear_trans_type_flag CATCH transaction_swap flag_swap_transaction 1 LOAD validate_amount 64 RELOAD validate_amount