Updated on 2026-08-14

This commit is contained in:
Tangem 2018-12-21 17:10:19 +03:00
parent 4aea39f62a
commit 540f78ef03
7 changed files with 62 additions and 216 deletions

View file

@ -49,8 +49,6 @@ dependencies {
implementation project(':tangemserver-android')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.zxing:core:3.3.3'
@ -73,4 +71,5 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'org.greenrobot:eventbus:3.1.1'
}

View file

@ -46,7 +46,6 @@ object Constant {
const val EXTRA_NEW_PIN = "newPIN"
const val EXTRA_NEW_PIN_2 = "newPIN2"
// CreateNewWalletActivity
const val RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER
@ -54,4 +53,8 @@ object Constant {
const val REQUEST_CODE_CREATE_NEW_WALLET_ACTIVITY = 2
const val REQUEST_CODE_REQUEST_PIN2 = 3
// ConfirmPaymentActivity
const val REQUEST_CODE_SIGN_PAYMENT = 1
const val REQUEST_CODE_REQUEST_PIN2_ = 2
}

View file

@ -12,48 +12,38 @@ import android.text.TextWatcher
import android.view.KeyEvent
import android.view.View
import android.widget.Toast
import com.tangem.Constant
import com.tangem.data.Blockchain
import com.tangem.domain.wallet.CoinEngine
import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.TangemContext
import com.tangem.presentation.event.ConfirmPaymentFinishWithError
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.tangemcard.data.TangemCard
import com.tangem.tangemcard.data.loadFromBundle
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_confirm_payment.*
import org.greenrobot.eventbus.EventBus
import java.io.IOException
import java.util.*
class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
companion object {
private const val REQUEST_CODE_SIGN_PAYMENT = 1
private const val REQUEST_CODE_REQUEST_PIN2 = 2
}
private var nfcManager: NfcManager? = null
// private var serverApiCommon: ServerApiCommon = ServerApiCommon()
// private var serverApiInfura: ServerApiInfura = ServerApiInfura()
// private var serverApiElectrum: ServerApiElectrum = ServerApiElectrum()
private lateinit var ctx: TangemContext
private lateinit var amount: CoinEngine.Amount
// private var feeRequestSuccess = false
// private var balanceRequestSuccess = false
private var isIncludeFee: Boolean = true
private var requestPIN2Count = 0
private var nodeCheck = true
private var dtVerified: Date? = null
// private var calcSize: Int = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_confirm_payment)
// MainActivity.commonInit(applicationContext)
nfcManager = NfcManager(this, this)
ctx = TangemContext.loadFromBundle(this, intent.extras)
@ -85,8 +75,6 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
etFee.setText("")
btnSend.visibility = View.INVISIBLE
// feeRequestSuccess = false
// balanceRequestSuccess = false
if (ctx.blockchain == Blockchain.Ethereum || ctx.blockchain == Blockchain.EthereumTestNet || ctx.blockchain == Blockchain.Token ||
ctx.blockchain == Blockchain.BitcoinCash || ctx.blockchain == Blockchain.Litecoin) {
@ -175,10 +163,10 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
requestPIN2Count = 0
val intent = Intent(baseContext, PinRequestActivity::class.java)
intent.putExtra("mode", PinRequestActivity.Mode.RequestPIN2.toString())
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
intent.putExtra(SignPaymentActivity.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, REQUEST_CODE_REQUEST_PIN2)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_)
}
val coinEngine = CoinEngineFactory.create(ctx)
@ -189,13 +177,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
object : CoinEngine.BlockchainRequestsCallbacks {
override fun onComplete(success: Boolean) {
if (success) {
onProgress()
// etFee.error = null
// feeRequestSuccess = true
// balanceRequestSuccess = true
progressBar.visibility = View.INVISIBLE
dtVerified = Date()
} else {
@ -213,134 +195,6 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
},
etWallet.text.toString(),
amount)
// request electrum listener
// val electrumBodyListener: ServerApiHelperElectrum.ElectrumRequestDataListener = object : ServerApiHelperElectrum.ElectrumRequestDataListener {
// override fun onSuccess(electrumRequest: ElectrumRequest?) {
// if (electrumRequest!!.isMethod(ElectrumRequest.METHOD_GetBalance)) {
// try {
// if (etFee.text.toString().isEmpty()) etFee.setText(getString(R.string.empty))
// val engine = CoinEngineFactory.create(ctx)
// val balance = engine.convertToAmount(CoinEngine.InternalAmount(electrumRequest.result.getLong("confirmed") + electrumRequest.result.getLong("unconfirmed"), "Satoshi"))
// val amount = CoinEngine.Amount(etAmount.text.toString(), ctx.blockchain.currency)
// if (balance < amount) {
// etFee.error = getString(R.string.not_enough_funds)
// } else {
// etFee.error = null
// balanceRequestSuccess = true
// if (feeRequestSuccess && balanceRequestSuccess) {
// btnSend.visibility = View.VISIBLE
// }
// dtVerified = Date()
// nodeCheck = true
// }
// } catch (e: JSONException) {
// e.printStackTrace()
//// requestElectrum(ctx.card!!, ElectrumRequest.checkBalance(ctx.card!!.wallet))
// }
// }
// }
//
// override fun onFail(message: String?) {
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_check_balance_no_connection_with_blockchain_nodes))
// }
//
// }
// serverApiHelperElectrum.setElectrumRequestData(electrumBodyListener)
// request infura eth gasPrice listener
// val infuraBodyListener: ServerApiInfura.InfuraBodyListener = object : ServerApiInfura.InfuraBodyListener {
// override fun onSuccess(method: String, infuraResponse: InfuraResponse) {
// when (method) {
// ServerApiInfura.INFURA_ETH_GAS_PRICE -> {
// var gasPrice = infuraResponse.result
// gasPrice = gasPrice.substring(2)
// //TODO - remove Gwei
// // rounding gas price to integer gwei
// val l = BigInteger(gasPrice, 16).divide(BigInteger.valueOf(1000000000L)).multiply(BigInteger.valueOf(1000000000L))
//
// //val m = if (ctx.blockchain==Blockchain.Token) BigInteger.valueOf(60000) else BigInteger.valueOf(21000)
// val m = if (amount.currency != "ETH") BigInteger.valueOf(60000) else BigInteger.valueOf(21000)
// val weiMinFee = CoinEngine.InternalAmount(l.multiply(m), "wei")
// val weiNormalFee = CoinEngine.InternalAmount(weiMinFee.multiply(BigDecimal.valueOf(12)).divide(BigDecimal.valueOf(10)), "wei")
// val weiMaxFee = CoinEngine.InternalAmount(weiMinFee.multiply(BigDecimal.valueOf(15)).divide(BigDecimal.valueOf(10)), "wei")
//
// minFee = engine.convertToAmount(weiMinFee)
// normalFee = engine.convertToAmount(weiNormalFee)
// maxFee = engine.convertToAmount(weiMaxFee)
// doSetFee(rgFee.checkedRadioButtonId)
// //etFee.setText(weiNormalFee.toValueString())
// etFee.error = null
// btnSend.visibility = View.VISIBLE
// feeRequestSuccess = true
//// balanceRequestSuccess = true
// dtVerified = Date()
// }
// }
// }
//
// override fun onFail(method: String, message: String) {
// when (method) {
// ServerApiInfura.INFURA_ETH_GAS_PRICE -> {
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
// }
// }
// }
// }
// serverApiInfura.setInfuraResponse(infuraBodyListener)
// // request estimate fee listener
// val estimateFeeListener: ServerApiCommon.EstimateFeeListener = object : ServerApiCommon.EstimateFeeListener {
// override fun onSuccess(blockCount: Int, estimateFeeResponse: String?) {
// var fee: BigDecimal?
// fee = BigDecimal(estimateFeeResponse) // BTC per 1 kb
//
// if (fee == BigDecimal.ZERO) {
// progressBar.visibility = View.INVISIBLE
// requestEstimateFee()
// }
//
// if (calcSize.toLong() != 0L) {
// fee = fee.multiply(BigDecimal(calcSize.toLong())).divide(BigDecimal(1024)) // per Kb -> per byte
// } else {
// requestEstimateFee()
// }
//
// progressBar.visibility = View.INVISIBLE
//
// fee = fee!!.setScale(8, RoundingMode.DOWN)
//
// when (blockCount) {
// ServerApiCommon.ESTIMATE_FEE_MINIMAL -> {
// minFee = CoinEngine.Amount(fee, engine.feeCurrency)
// if (rgFee.checkedRadioButtonId == R.id.rbMinimalFee) doSetFee(rgFee.checkedRadioButtonId)
// }
//
// ServerApiCommon.ESTIMATE_FEE_NORMAL -> {
// normalFee = CoinEngine.Amount(fee, engine.feeCurrency)
// if (rgFee.checkedRadioButtonId == R.id.rbNormalFee) doSetFee(rgFee.checkedRadioButtonId)
// }
//
// ServerApiCommon.ESTIMATE_FEE_PRIORITY -> {
// maxFee = CoinEngine.Amount(fee, engine.feeCurrency)
// if (rgFee.checkedRadioButtonId == R.id.rbMaximumFee) doSetFee(rgFee.checkedRadioButtonId)
// }
// }
//
// etFee.error = null
// feeRequestSuccess = true
// if (feeRequestSuccess)
//// if (feeRequestSuccess && balanceRequestSuccess)
// btnSend.visibility = View.VISIBLE
// dtVerified = Date()
// }
//
// override fun onFail(message: String?) {
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_calculate_fee_wrong_data_received_from_node))
// }
// }
// serverApiCommon.setEstimateFee(estimateFeeListener)
}
public override fun onResume() {
@ -360,7 +214,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE_SIGN_PAYMENT) {
if (requestCode == Constant.REQUEST_CODE_SIGN_PAYMENT) {
if (data != null && data.extras != null) {
if (data.extras!!.containsKey("UID") && data.extras!!.containsKey("Card")) {
val updatedCard = TangemCard(data.getStringExtra("UID"))
@ -371,15 +225,15 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (resultCode == SignPaymentActivity.RESULT_INVALID_PIN && requestPIN2Count < 2) {
requestPIN2Count++
val intent = Intent(baseContext, PinRequestActivity::class.java)
intent.putExtra("mode", PinRequestActivity.Mode.RequestPIN2.toString())
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
intent.putExtra(SignPaymentActivity.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, REQUEST_CODE_REQUEST_PIN2)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_)
return
}
setResult(resultCode, data)
finish()
} else if (requestCode == REQUEST_CODE_REQUEST_PIN2) {
} else if (requestCode == Constant.REQUEST_CODE_REQUEST_PIN2_) {
if (resultCode == Activity.RESULT_OK) {
val intent = Intent(baseContext, SignPaymentActivity::class.java)
ctx.saveToIntent(intent)
@ -389,7 +243,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
intent.putExtra(SignPaymentActivity.EXTRA_FEE, etFee.text.toString())
intent.putExtra(SignPaymentActivity.EXTRA_FEE_CURRENCY, tvCurrency2.text.toString())
intent.putExtra(SignPaymentActivity.EXTRA_FEE_INCLUDED, isIncludeFee)
startActivityForResult(intent, REQUEST_CODE_SIGN_PAYMENT)
startActivityForResult(intent, Constant.REQUEST_CODE_SIGN_PAYMENT)
} else
Toast.makeText(baseContext, R.string.pin_2_is_required_to_sign_the_payment, Toast.LENGTH_LONG).show()
}
@ -415,38 +269,6 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
}
// TODO - move to BtcEngine
// @Throws(Exception::class)
// private fun requestElectrum(ctx: TangemContext, electrumRequest: ElectrumRequest) {
// if (UtilHelper.isOnline(this)) {
// serverApiElectrum.electrumRequestData(ctx, electrumRequest)
// } else
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
// }
// private fun requestInfura(method: String) {
// if (UtilHelper.isOnline(this)) {
// serverApiInfura.infura(method, 67, ctx.coinData!!.wallet, "", "")
// } else
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
// }
// private fun requestEstimateFee() {
// if (calcSize == 0) {
// calcSize = 256
// try {
//
// calcSize = buildSize(etWallet!!.text.toString(), "0.00", etAmount.text.toString())
// } catch (ex: Exception) {
// Log.e("Build Fee error", ex.message)
// }
// }
// serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_PRIORITY)
// serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_NORMAL)
// serverApiCommon.estimateFee(ServerApiCommon.ESTIMATE_FEE_MINIMAL)
// }
private fun doSetFee(checkedRadioButtonId: Int) {
var txtFee = ""
when (checkedRadioButtonId) {
@ -454,7 +276,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (ctx.coinData.minFee != null) {
txtFee = ctx.coinData.minFee!!.toValueString()
btnSend.visibility = View.VISIBLE
}else {
} else {
btnSend.visibility = View.INVISIBLE
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
}
@ -462,7 +284,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (ctx.coinData.normalFee != null) {
txtFee = ctx.coinData.normalFee!!.toValueString()
btnSend.visibility = View.VISIBLE
}else {
} else {
btnSend.visibility = View.INVISIBLE
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
}
@ -470,7 +292,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
if (ctx.coinData.maxFee != null) {
txtFee = ctx.coinData.maxFee!!.toValueString()
btnSend.visibility = View.VISIBLE
}else {
} else {
// finishWithError(Activity.RESULT_CANCELED, getString(R.string.cannot_obtain_data_from_blockchain))
btnSend.visibility = View.INVISIBLE
}
@ -479,6 +301,10 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
private fun finishWithError(errorCode: Int, message: String) {
val confirmPaymentFinishWithError = ConfirmPaymentFinishWithError()
confirmPaymentFinishWithError.message = message
EventBus.getDefault().post(confirmPaymentFinishWithError)
val intent = Intent()
intent.putExtra("message", message)
setResult(errorCode, intent)

View file

@ -16,6 +16,7 @@ import com.tangem.data.Blockchain
import com.tangem.domain.wallet.CoinEngineFactory
import com.tangem.domain.wallet.TangemContext
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.util.LOG
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_prepare_payment.*
import java.io.IOException
@ -177,7 +178,6 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
}
etWallet!!.setText(code)
} else if (requestCode == REQUEST_CODE_SEND_PAYMENT) {
setResult(resultCode, data)
finish()
}

View file

@ -28,7 +28,6 @@ import com.tangem.tangemcard.util.Util
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_sign_payment.*
class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
companion object {
@ -47,7 +46,6 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
private lateinit var nfcManager: NfcManager
private lateinit var ctx: TangemContext
// private var signPaymentTask: SignPaymentTask? = null
private var signPaymentTask: SignTask? = null
private lateinit var amount: CoinEngine.Amount
@ -62,13 +60,11 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sign_payment)
// MainActivity.commonInit(applicationContext)
nfcManager = NfcManager(this, this)
ctx=TangemContext.loadFromBundle(this, intent.extras)
ctx = TangemContext.loadFromBundle(this, intent.extras)
amount = CoinEngine.Amount(intent.getStringExtra(EXTRA_AMOUNT), intent.getStringExtra(EXTRA_AMOUNT_CURRENCY))
amount = CoinEngine.Amount(intent.getStringExtra(EXTRA_AMOUNT), intent.getStringExtra(EXTRA_AMOUNT_CURRENCY))
fee = CoinEngine.Amount(intent.getStringExtra(EXTRA_FEE), intent.getStringExtra(EXTRA_FEE_CURRENCY))
isIncludeFee = intent.getBooleanExtra(EXTRA_FEE_INCLUDED, true)
outAddressStr = intent.getStringExtra(EXTRA_TARGET_ADDRESS)
@ -82,11 +78,11 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
public override fun onResume() {
super.onResume()
nfcManager!!.onResume()
nfcManager.onResume()
}
public override fun onPause() {
nfcManager!!.onPause()
nfcManager.onPause()
if (signPaymentTask != null)
signPaymentTask!!.cancel(true)
super.onPause()
@ -94,7 +90,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
public override fun onStop() {
// dismiss enable NFC dialog
nfcManager!!.onStop()
nfcManager.onStop()
if (signPaymentTask != null)
signPaymentTask!!.cancel(true)
super.onStop()
@ -128,7 +124,6 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
?: throw CardProtocol.TangemException(getString(R.string.wrong_tag_err))
val uid = tag.id
val sUID = Util.byteArrayToHexString(uid)
// Log.v(TAG, "UID: $sUID")
if (sUID == ctx.card!!.uid) {
if (lastReadSuccess) {
@ -136,7 +131,6 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
} else {
isoDep.timeout = ctx.card!!.pauseBeforePIN2 + 65000
}
// signPaymentTask = SignPaymentTask(this, ctx, nfcManager, isoDep, this, amount, fee, isIncludeFee, outAddressStr)
val coinEngine = CoinEngineFactory.create(ctx)
?: throw CardProtocol.TangemException("Can't create CoinEngine!")
@ -152,13 +146,10 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
signPaymentTask = SignTask(ctx.card, NfcReader(nfcManager, isoDep), App.localStorage, App.pinStorage, this, paymentToSign)
signPaymentTask!!.start()
} else {
// Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + card!!.uid + ")")
nfcManager!!.ignoreTag(isoDep.tag)
}
} else
nfcManager.ignoreTag(isoDep.tag)
}catch (e: CardProtocol.TangemException_WrongAmount)
{
} catch (e: CardProtocol.TangemException_WrongAmount) {
try {
val intent = Intent()
intent.putExtra("message", getString(R.string.cannot_sign_transaction_wrong_amount))

View file

@ -0,0 +1,5 @@
package com.tangem.presentation.event
class ConfirmPaymentFinishWithError {
var message: String? = null
}

View file

@ -13,7 +13,6 @@ import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
import android.text.Html
//import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -32,6 +31,7 @@ import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
import com.tangem.presentation.dialog.PINSwapWarningDialog
import com.tangem.presentation.dialog.ShowQRCodeDialog
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
import com.tangem.presentation.event.ConfirmPaymentFinishWithError
import com.tangem.tangemcard.android.reader.NfcManager
import com.tangem.tangemcard.android.reader.NfcReader
import com.tangem.tangemcard.data.EXTRA_TANGEM_CARD
@ -47,6 +47,11 @@ import com.tangem.util.LOG
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.fr_loaded_wallet.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.io.InputStream
import java.util.*
@ -295,13 +300,29 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
timerRepeatRefresh!!.cancel()
}
override fun onStart() {
super.onStart()
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this)
}
override fun onStop() {
super.onStop()
nfcManager.onStop()
}
override fun onDestroy() {
EventBus.getDefault().unregister(this)
super.onDestroy()
}
@Subscribe
fun onConfirmPaymentFinishWithError(confirmPaymentFinishWithError: ConfirmPaymentFinishWithError) {
ctx.error = confirmPaymentFinishWithError.message
updateViews()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// var data = data
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
Constant.REQUEST_CODE_VERIFY_CARD ->
@ -361,7 +382,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
if (resultCode == Constant.RESULT_INVALID_PIN && requestPIN2Count < 2) {
requestPIN2Count++
val intent = Intent(activity, PinRequestActivity::class.java)
intent.putExtra("mode", PinRequestActivity.Mode.RequestPIN2.toString())
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN)
return
@ -396,7 +417,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
if (resultCode == Constant.RESULT_INVALID_PIN && requestPIN2Count < 2) {
requestPIN2Count++
val intent = Intent(activity, PinRequestActivity::class.java)
intent.putExtra("mode", PinRequestActivity.Mode.RequestPIN2.toString())
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
ctx.saveToIntent(intent)
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_FOR_PURGE)
return
@ -409,6 +430,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
}
Constant.REQUEST_CODE_SEND_PAYMENT, Constant.REQUEST_CODE_RECEIVE_PAYMENT -> {
LOG.i("finishWithError", "REQUEST_CODE_SEND_PAYMENT")
if (resultCode == Activity.RESULT_OK) {
ctx.coinData?.clearInfo()
srl?.postDelayed({ this.refresh() }, 5000)