Updated on 2026-08-14
This commit is contained in:
parent
6b245fd0d6
commit
be707f0f4f
5 changed files with 45 additions and 13 deletions
|
|
@ -20,12 +20,14 @@ import com.tangem.tangemcard.android.reader.NfcManager
|
|||
import com.tangem.domain.wallet.TangemContext
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
|
||||
import com.tangem.presentation.event.DeletingWalletFinish
|
||||
import com.tangem.tangemcard.android.reader.NfcReader
|
||||
import com.tangem.tangemcard.data.asBundle
|
||||
import com.tangem.tangemcard.util.Util
|
||||
import com.tangem.util.LOG
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.android.synthetic.main.activity_purge.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtocol.Notifications {
|
||||
companion object {
|
||||
|
|
@ -132,6 +134,9 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
|
|||
intent.putExtra("UID", cardProtocol.card.uid)
|
||||
intent.putExtra("Card", cardProtocol.card.asBundle)
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
|
||||
EventBus.getDefault().post(DeletingWalletFinish())
|
||||
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
package com.tangem.presentation.event
|
||||
|
||||
class DeletingWalletFinish
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
package com.tangem.presentation.event
|
||||
|
||||
class ReadAfterRequest {
|
||||
}
|
||||
class ReadAfterRequest
|
||||
|
|
@ -10,7 +10,6 @@ import android.nfc.NfcAdapter
|
|||
import android.nfc.Tag
|
||||
import android.nfc.tech.IsoDep
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.core.content.ContextCompat
|
||||
import android.text.Html
|
||||
import android.view.Gravity
|
||||
|
|
@ -35,6 +34,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.DeletingWalletFinish
|
||||
import com.tangem.presentation.event.TransactionFinishWithError
|
||||
import com.tangem.presentation.event.TransactionFinishWithSuccess
|
||||
import com.tangem.tangemcard.android.reader.NfcManager
|
||||
|
|
@ -317,6 +317,11 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
updateViews()
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
fun onDeleteWalletFinish(deletingWalletFinish: DeletingWalletFinish) {
|
||||
activity?.finish()
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import android.content.Intent
|
|||
import android.nfc.NfcAdapter
|
||||
import android.nfc.Tag
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.core.content.ContextCompat
|
||||
import android.text.Html
|
||||
import android.text.format.DateUtils
|
||||
|
|
@ -21,6 +20,7 @@ import com.tangem.domain.wallet.CoinEngineFactory
|
|||
import com.tangem.domain.wallet.TangemContext
|
||||
import com.tangem.presentation.activity.*
|
||||
import com.tangem.presentation.dialog.PINSwapWarningDialog
|
||||
import com.tangem.presentation.event.DeletingWalletFinish
|
||||
import com.tangem.tangemcard.android.data.PINStorage
|
||||
import com.tangem.tangemcard.android.reader.NfcManager
|
||||
import com.tangem.tangemcard.data.TangemCard
|
||||
|
|
@ -30,6 +30,8 @@ import com.tangem.util.LOG
|
|||
import com.tangem.wallet.BuildConfig
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.android.synthetic.main.fr_verify_card.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
|
|
@ -73,6 +75,22 @@ class VerifyCard : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
if (!EventBus.getDefault().isRegistered(this))
|
||||
EventBus.getDefault().register(this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
EventBus.getDefault().unregister(this)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
fun onDeleteWalletFinish(deletingWalletFinish: DeletingWalletFinish) {
|
||||
activity?.finish()
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
LOG.i(TAG, "requestCode $requestCode resultCode $resultCode")
|
||||
|
|
@ -158,16 +176,18 @@ class VerifyCard : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback {
|
|||
Constant.REQUEST_CODE_REQUEST_PIN2_FOR_PURGE -> if (resultCode == Activity.RESULT_OK)
|
||||
(activity as VerifyCardActivity).navigator.showPurge(context as Activity, ctx)
|
||||
|
||||
Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data == null) {
|
||||
ctx.saveToIntent(data)
|
||||
data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
|
||||
} else
|
||||
data.putExtra(Constant.EXTRA_MODIFICATION, "update")
|
||||
// Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
|
||||
// if (data == null) {
|
||||
// ctx.saveToIntent(data)
|
||||
// data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
|
||||
// } else
|
||||
// data.putExtra(Constant.EXTRA_MODIFICATION, "update")
|
||||
//
|
||||
// activity?.setResult(Activity.RESULT_OK, data)
|
||||
// activity?.finish()
|
||||
// }
|
||||
|
||||
activity?.setResult(Activity.RESULT_OK, data)
|
||||
activity?.finish()
|
||||
} else {
|
||||
else {
|
||||
if (data != null && data.extras!!.containsKey("UID") && data.extras!!.containsKey("Card")) {
|
||||
val updatedCard = TangemCard(data.getStringExtra("UID"))
|
||||
updatedCard.loadFromBundle(data.getBundleExtra("Card"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue