Updated on 2026-08-14
This commit is contained in:
parent
75f6f589d2
commit
8e56feae88
5 changed files with 27 additions and 17 deletions
|
|
@ -32,6 +32,10 @@ class Navigator {
|
|||
context.startActivityForResult(PinRequestActivity.callingIntentRequestPin2(context, mode, ctx, newPin2), Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN)
|
||||
}
|
||||
|
||||
fun showPinRequestRequestPin2(context: Activity, mode: String, ctx: TangemContext) {
|
||||
context.startActivityForResult(PinRequestActivity.callingIntentRequestPin2(context, mode, ctx), Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN)
|
||||
}
|
||||
|
||||
fun showPinRequestConfirmNewPin(context: Activity, mode: String, newPin: String) {
|
||||
context.startActivityForResult(PinRequestActivity.callingIntentConfirmPin(context, mode, newPin), Constant.REQUEST_CODE_ENTER_NEW_PIN)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,18 +209,19 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
if (resultCode == Constant.RESULT_INVALID_PIN_ && requestPIN2Count < 2) {
|
||||
requestPIN2Count++
|
||||
|
||||
val intent = Intent(baseContext, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
|
||||
ctx.saveToIntent(intent)
|
||||
intent.putExtra(Constant.EXTRA_FEE_INCLUDED, isIncludeFee)
|
||||
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_)
|
||||
|
||||
return
|
||||
}
|
||||
setResult(resultCode, data)
|
||||
finish()
|
||||
} else if (requestCode == Constant.REQUEST_CODE_REQUEST_PIN2_) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
LOG.i("SDSDW", "sdwwd")
|
||||
val intent = Intent(baseContext, SignPaymentActivity::class.java)
|
||||
ctx.saveToIntent(intent)
|
||||
intent.putExtra(Constant.EXTRA_TARGET_ADDRESS, etWallet!!.text.toString())
|
||||
|
|
|
|||
|
|
@ -46,11 +46,20 @@ class PinRequestActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Finge
|
|||
fun callingIntentRequestPin(context: Activity, mode: String, ctx: TangemContext, newPIN: String): Intent {
|
||||
val intent = Intent(context, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_MODE, mode)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN, newPIN)
|
||||
ctx.saveToIntent(intent)
|
||||
return intent
|
||||
}
|
||||
|
||||
fun callingIntentRequestPin2(context: Activity, mode: String, ctx: TangemContext, newPIN2: String): Intent {
|
||||
val intent = Intent(context, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_MODE, mode)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN_2, newPIN2)
|
||||
ctx.saveToIntent(intent)
|
||||
return intent
|
||||
}
|
||||
|
||||
fun callingIntentRequestPin2(context: Activity, mode: String, ctx: TangemContext): Intent {
|
||||
val intent = Intent(context, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_MODE, mode)
|
||||
ctx.saveToIntent(intent)
|
||||
|
|
@ -59,15 +68,15 @@ class PinRequestActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Finge
|
|||
|
||||
fun callingIntentConfirmPin(context: Activity, mode: String, newPIN: String): Intent {
|
||||
val intent = Intent(context, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN, newPIN)
|
||||
intent.putExtra(Constant.EXTRA_MODE, mode)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN, newPIN)
|
||||
return intent
|
||||
}
|
||||
|
||||
fun callingIntentConfirmPin2(context: Activity, mode: String, newPin2: String): Intent {
|
||||
fun callingIntentConfirmPin2(context: Activity, mode: String, newPIN2: String): Intent {
|
||||
val intent = Intent(context, PinRequestActivity::class.java)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN_2, newPin2)
|
||||
intent.putExtra(Constant.EXTRA_MODE, mode)
|
||||
intent.putExtra(Constant.EXTRA_NEW_PIN_2, newPIN2)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,10 +369,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(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
|
||||
ctx.saveToIntent(intent)
|
||||
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN)
|
||||
(activity as LoadedWalletActivity).navigator.showPinRequestRequestPin2(context as Activity, PinRequestActivity.Mode.RequestPIN2.toString(), ctx)
|
||||
return
|
||||
} else {
|
||||
if (data != null && data.extras!!.containsKey("message")) {
|
||||
|
|
@ -381,10 +378,6 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
}
|
||||
}
|
||||
|
||||
// TODO unused block, need check and remove it
|
||||
// Constant.REQUEST_CODE_REQUEST_PIN2_FOR_PURGE -> if (resultCode == Activity.RESULT_OK)
|
||||
// (activity as LoadedWalletActivity).navigator.showPurge(context as Activity, ctx)
|
||||
|
||||
Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data == null) {
|
||||
ctx.saveToIntent(data)
|
||||
|
|
@ -403,10 +396,12 @@ 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(Constant.EXTRA_MODE, PinRequestActivity.Mode.RequestPIN2.toString())
|
||||
ctx.saveToIntent(intent)
|
||||
startActivityForResult(intent, Constant.REQUEST_CODE_REQUEST_PIN2_FOR_PURGE)
|
||||
|
||||
return
|
||||
} else {
|
||||
if (data != null && data.extras!!.containsKey("message")) {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
// set listeners
|
||||
fabMenu.setOnClickListener { showMenu(fabMenu) }
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
val data = prepareResultIntent()
|
||||
data.putExtra(Constant.EXTRA_MODIFICATION, "update")
|
||||
|
|
@ -89,7 +90,7 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
var data = data
|
||||
// var data = data
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
when (requestCode) {
|
||||
Constant.REQUEST_CODE_ENTER_NEW_PIN -> if (resultCode == Activity.RESULT_OK) {
|
||||
|
|
@ -142,9 +143,9 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
Constant.REQUEST_CODE_SWAP_PIN -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data == null) {
|
||||
data = Intent()
|
||||
// data = Intent()
|
||||
ctx.saveToIntent(data)
|
||||
data.putExtra("modification", "delete")
|
||||
data?.putExtra("modification", "delete")
|
||||
} else
|
||||
data.putExtra("modification", "update")
|
||||
activity!!.setResult(Activity.RESULT_OK, data)
|
||||
|
|
@ -174,9 +175,9 @@ class VerifyCard : Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
Constant.REQUEST_CODE_PURGE -> if (resultCode == Activity.RESULT_OK) {
|
||||
if (data == null) {
|
||||
data = Intent()
|
||||
// data = Intent()
|
||||
ctx.saveToIntent(data)
|
||||
data.putExtra(Constant.EXTRA_MODIFICATION, "delete")
|
||||
data?.putExtra(Constant.EXTRA_MODIFICATION, "delete")
|
||||
} else {
|
||||
data.putExtra(Constant.EXTRA_MODIFICATION, "update")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue