Force the app to go back to the home screen once a transaction is successfuly sent.

This commit is contained in:
Severiano Jaramillo 2019-01-15 11:22:28 -06:00
parent 33f45a6775
commit cb07673c8d

View file

@ -12,6 +12,7 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import androidx.navigation.fragment.findNavController
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.google.common.primitives.UnsignedLong import com.google.common.primitives.UnsignedLong
@ -276,15 +277,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
if (message.result == null && message.error == null) { if (message.result == null && message.error == null) {
context?.toast(getString(R.string.text__transaction_sent)) context?.toast(getString(R.string.text__transaction_sent))
// Remove information from the text fields and disable send button // Return to the main screen
tietTo.setText("") findNavController().navigateUp()
tietAmount.setText("")
tietMemo.setText("")
isToAccountCorrect = false
isAmountCorrect = false
enableDisableSendFAB()
// TODO return to Main fragment ??
} else { } else {
context?.toast(message.error.message, Toast.LENGTH_LONG) context?.toast(message.error.message, Toast.LENGTH_LONG)
} }
@ -422,7 +416,7 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
val privateKey = ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, wifKey).key.privKeyBytes) val privateKey = ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, wifKey).key.privKeyBytes)
// Add memo if exists TODO enable memo // Add memo if exists
val memoMsg = tietMemo.text.toString() val memoMsg = tietMemo.text.toString()
if (memoMsg.isNotEmpty()) { if (memoMsg.isNotEmpty()) {
val nonce = Math.abs(SecureRandomGenerator.getSecureRandom().nextLong()).toBigInteger() val nonce = Math.abs(SecureRandomGenerator.getSecureRandom().nextLong()).toBigInteger()