Updated on 2026-08-14
This commit is contained in:
commit
6eed5da249
29 changed files with 251 additions and 49 deletions
|
|
@ -18,6 +18,7 @@ import com.tangem.tangem_card.data.TangemCard
|
|||
import com.tangem.tangem_card.reader.CardProtocol
|
||||
import com.tangem.tangem_card.tasks.CustomReadCardTask
|
||||
import com.tangem.tangem_card.tasks.ReadCardInfoTask
|
||||
import com.tangem.tangem_sdk.android.data.PINStorage
|
||||
import com.tangem.tangem_sdk.android.nfc.NfcDeviceAntennaLocation
|
||||
import com.tangem.tangem_sdk.android.reader.NfcReader
|
||||
import com.tangem.tangem_sdk.data.EXTRA_TANGEM_CARD
|
||||
|
|
@ -129,6 +130,10 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
|
||||
lastTag = tag
|
||||
|
||||
val terminalKeys = viewModel.getTerminalKeys()
|
||||
PINStorage.setTerminalPrivateKey(terminalKeys[Constant.TERMINAL_PRIVATE_KEY])
|
||||
PINStorage.setTerminalPublicKey(terminalKeys[Constant.TERMINAL_PUBLIC_KEY])
|
||||
|
||||
task = ReadCardInfoTask(NfcReader((activity as MainActivity).nfcManager, isoDep),
|
||||
App.localStorage, App.pinStorage, this)
|
||||
task?.start()
|
||||
|
|
@ -166,6 +171,10 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
val card = TangemCard(uid)
|
||||
cardInfo.getBundle(EXTRA_TANGEM_CARD)?.let { card.loadFromBundle(it) }
|
||||
|
||||
val terminalKeys = viewModel.getTerminalKeys()
|
||||
card.terminalPrivateKey = terminalKeys[Constant.TERMINAL_PRIVATE_KEY]
|
||||
card.terminalPublicKey = terminalKeys[Constant.TERMINAL_PUBLIC_KEY]
|
||||
|
||||
val ctx = TangemContext(card)
|
||||
|
||||
when {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.tangem.Constant
|
||||
import com.tangem.data.dp.PrefsManager
|
||||
import com.tangem.data.network.ServerApiCommon
|
||||
import com.tangem.wallet.BuildConfig
|
||||
|
||||
|
|
@ -35,4 +36,9 @@ class MainViewModel : ViewModel() {
|
|||
}
|
||||
serverApiCommon.requestLastVersion()
|
||||
}
|
||||
|
||||
fun getTerminalKeys(): Map<String, ByteArray> {
|
||||
return PrefsManager.getInstance().terminalKeys
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -354,8 +354,13 @@ class VerifyCardFragment : BaseFragment(), NavigationResultListener, NfcAdapter.
|
|||
if (ctx.card!!.supportBlock()!!)
|
||||
features += getString(R.string.details_blockable)
|
||||
|
||||
if (ctx.card!!.supportLinkingTerminal()) {
|
||||
features += getString(R.string.details_linking_card_supported)
|
||||
llLinkedCard.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (ctx.card!!.supportOnlyOneCommandAtTime()!!)
|
||||
|
||||
if (ctx.card!!.supportOnlyOneCommandAtTime())
|
||||
features += getString(R.string.details_atomic_commmands)
|
||||
|
||||
if (features.endsWith("\n"))
|
||||
|
|
@ -363,6 +368,13 @@ class VerifyCardFragment : BaseFragment(), NavigationResultListener, NfcAdapter.
|
|||
|
||||
tvFeatures.text = features
|
||||
|
||||
val textIsLinked = if (ctx.card.terminalIsLinked) {
|
||||
getString(R.string.details_linked_card_to_phone)
|
||||
} else {
|
||||
getString(R.string.general_no)
|
||||
}
|
||||
tvIsLinked.text = textIsLinked
|
||||
|
||||
if (ctx.card!!.useDefaultPIN1()) {
|
||||
imgPIN.setImageResource(R.drawable.unlock_pin1)
|
||||
imgPIN.setOnClickListener { Toast.makeText(context, R.string.details_protected_by_default_pin_1, Toast.LENGTH_LONG).show() }
|
||||
|
|
|
|||
|
|
@ -595,14 +595,14 @@ class LoadedWalletFragment : BaseFragment(), NavigationResultListener, NfcAdapte
|
|||
}
|
||||
|
||||
if (ctx.message == null || ctx.message.isEmpty()) {
|
||||
tvMessage.text = ""
|
||||
tvMessage.visibility = View.GONE
|
||||
tvMessage?.text = ""
|
||||
tvMessage?.visibility = View.GONE
|
||||
} else {
|
||||
tvMessage.text = ctx.message
|
||||
tvMessage.visibility = View.VISIBLE
|
||||
tvMessage?.text = ctx.message
|
||||
tvMessage?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (tvError.visibility == View.VISIBLE || tvMessage.visibility == View.VISIBLE) {
|
||||
if (tvError?.visibility == View.VISIBLE || tvMessage?.visibility == View.VISIBLE) {
|
||||
timerHideErrorAndMessage = Timer()
|
||||
timerHideErrorAndMessage!!.schedule(
|
||||
timerTask {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue