Updated on 2026-08-14
This commit is contained in:
parent
3d1933ba3a
commit
d80dcf3369
2 changed files with 7 additions and 47 deletions
|
|
@ -666,6 +666,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
}
|
||||
|
||||
override fun allowAdvance(): Boolean {
|
||||
// TODO Caused by: kotlin.TypeCastException: null cannot be cast to non-null type android.app.Activity
|
||||
return UtilHelper.isOnline(context as Activity)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,11 @@ import kotlinx.android.synthetic.main.fr_verify_card.*
|
|||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
||||
|
||||
class VerifyCard : Fragment() {
|
||||
companion object {
|
||||
val TAG: String = VerifyCard::class.java.simpleName
|
||||
}
|
||||
|
||||
private var nfcManager: NfcManager? = null
|
||||
private lateinit var ctx: TangemContext
|
||||
|
||||
private var requestPIN2Count = 0
|
||||
|
|
@ -48,8 +46,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
nfcManager = NfcManager(activity, this)
|
||||
|
||||
ctx = TangemContext.loadFromBundle(activity, activity?.intent?.extras)
|
||||
}
|
||||
|
||||
|
|
@ -74,23 +70,7 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
nfcManager!!.onResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
nfcManager!!.onPause()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
nfcManager!!.onStop()
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
// var data = data
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
Constant.REQUEST_CODE_ENTER_NEW_PIN -> if (resultCode == Activity.RESULT_OK) {
|
||||
|
|
@ -109,6 +89,7 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Constant.REQUEST_CODE_ENTER_NEW_PIN2 -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data != null) {
|
||||
if (data.extras!!.containsKey("confirmPIN2")) {
|
||||
|
|
@ -125,10 +106,11 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (newPIN == "") newPIN = ctx.card!!.pin
|
||||
|
||||
if (newPIN2 == "") newPIN2 = App.pinStorage.getPIN2()
|
||||
if (newPIN2 == "") newPIN2 = App.pinStorage.piN2
|
||||
|
||||
val pinSwapWarningDialog = PINSwapWarningDialog()
|
||||
pinSwapWarningDialog.setOnRefreshPage { (activity as VerifyCardActivity).navigator.showPinSwap(context as Activity, newPIN, newPIN2) }
|
||||
|
|
@ -143,7 +125,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
Constant.REQUEST_CODE_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data == null) {
|
||||
// data = Intent()
|
||||
ctx.saveToIntent(data)
|
||||
data?.putExtra("modification", "delete")
|
||||
} else
|
||||
|
|
@ -177,9 +158,9 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
if (data == null) {
|
||||
ctx.saveToIntent(data)
|
||||
data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
|
||||
} else {
|
||||
} else
|
||||
data.putExtra(Constant.EXTRA_MODIFICATION, "update")
|
||||
}
|
||||
|
||||
activity!!.setResult(Activity.RESULT_OK, data)
|
||||
activity!!.finish()
|
||||
} else {
|
||||
|
|
@ -205,14 +186,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onTagDiscovered(tag: Tag) {
|
||||
try {
|
||||
nfcManager!!.ignoreTag(tag)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateViews() {
|
||||
try {
|
||||
if (timerHideErrorAndMessage != null) {
|
||||
|
|
@ -369,20 +342,6 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
tvWallet!!.setText(R.string.not_available)
|
||||
tvWalletIdentity.setText(R.string.no_data_string)
|
||||
}
|
||||
|
||||
// timerHideErrorAndMessage = Timer()
|
||||
// timerHideErrorAndMessage!!.schedule(object : TimerTask() {
|
||||
// override fun run() {
|
||||
// tvError.post {
|
||||
// tvMessage!!.visibility = View.GONE
|
||||
// tvError!!.visibility = View.GONE
|
||||
// mCard!!.error = null
|
||||
// mCard!!.message = null
|
||||
// }
|
||||
// }
|
||||
// }, 5000)
|
||||
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue