Updated on 2026-08-14

This commit is contained in:
Tangem 2019-07-09 14:19:18 +03:00
commit 635a235bf1
4 changed files with 42 additions and 22 deletions

View file

@ -90,10 +90,10 @@ dependencies {
implementation 'com.madgag.spongycastle:core:1.56.0.0'
implementation 'com.madgag.spongycastle:prov:1.56.0.0'
implementation 'com.scottyab:rootbeer-lib:0.0.7'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.6.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation "com.squareup.okhttp3:okhttp-sse:3.11.0"
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'

View file

@ -41,4 +41,10 @@ class PrefsManager {
Hawk.delete(Constant.PREF_LAST_WALLET_ADDRESS)
}
fun appendCid(newCid: String) {
val prevCids: String = Hawk.get("CID_Key", "")
if (!prevCids.contains(newCid)) Hawk.put("CID_Key", "$prevCids$newCid, ")
}
fun getAllCids(): String = Hawk.get("CID_Key", "")
}

View file

@ -13,7 +13,6 @@ import android.nfc.tech.IsoDep
import android.os.Build
import android.os.Bundle
import android.text.Html
import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -25,12 +24,21 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import com.tangem.App
import com.tangem.Constant
import com.tangem.card_android.android.nfc.NfcLifecycleObserver
import com.tangem.card_android.android.reader.NfcManager
import com.tangem.card_android.android.reader.NfcReader
import com.tangem.card_android.data.EXTRA_TANGEM_CARD
import com.tangem.card_android.data.EXTRA_TANGEM_CARD_UID
import com.tangem.card_android.data.loadFromBundle
import com.tangem.card_common.data.TangemCard
import com.tangem.card_common.reader.CardProtocol
import com.tangem.card_common.tasks.VerifyCardTask
import com.tangem.card_common.util.Util
import com.tangem.data.Blockchain
import com.tangem.data.dp.PrefsManager
import com.tangem.data.network.ServerApiCommon
import com.tangem.wallet.BalanceValidator
import com.tangem.wallet.CoinEngine
import com.tangem.wallet.CoinEngineFactory
import com.tangem.wallet.TangemContext
import com.tangem.server_android.ServerApiTangem
import com.tangem.server_android.model.CardVerifyAndGetInfo
import com.tangem.ui.activity.LoadedWalletActivity
import com.tangem.ui.activity.PinRequestActivity
import com.tangem.ui.activity.PrepareCryptonitWithdrawalActivity
@ -42,21 +50,9 @@ import com.tangem.ui.dialog.WaitSecurityDelayDialog
import com.tangem.ui.event.DeletingWalletFinish
import com.tangem.ui.event.TransactionFinishWithError
import com.tangem.ui.event.TransactionFinishWithSuccess
import com.tangem.card_android.android.nfc.NfcLifecycleObserver
import com.tangem.card_android.android.reader.NfcManager
import com.tangem.card_android.android.reader.NfcReader
import com.tangem.card_android.data.EXTRA_TANGEM_CARD
import com.tangem.card_android.data.EXTRA_TANGEM_CARD_UID
import com.tangem.card_android.data.loadFromBundle
import com.tangem.card_common.data.TangemCard
import com.tangem.card_common.reader.CardProtocol
import com.tangem.card_common.tasks.VerifyCardTask
import com.tangem.card_common.util.Util
import com.tangem.server_android.ServerApiTangem
import com.tangem.server_android.model.CardVerifyAndGetInfo
import com.tangem.util.LOG
import com.tangem.util.UtilHelper
import com.tangem.wallet.R
import com.tangem.wallet.*
import kotlinx.android.synthetic.main.fr_loaded_wallet.*
import kotlinx.android.synthetic.main.layout_btn_details.*
import kotlinx.android.synthetic.main.layout_tangem_card.*
@ -683,6 +679,8 @@ class LoadedWalletFragment : androidx.fragment.app.Fragment(), NfcAdapter.Reader
LOG.e(TAG, "requestBalanceAndUnspentTransactions ctx.error: " + ctx.error)
}
updateViews()
if (coinEngine.isBalanceNotZero) showWarningIfPendingTransactionIsPossible()
}
override fun onProgress() {
@ -707,6 +705,20 @@ class LoadedWalletFragment : androidx.fragment.app.Fragment(), NfcAdapter.Reader
}
}
private fun showWarningIfPendingTransactionIsPossible() {
if (ctx.card.signedHashes > 0 && isNewCid(ctx.card.cidDescription)) {
AlertDialog.Builder(context)
.setTitle(R.string.warning)
.setMessage(R.string.card_signed_transactions_warning)
.setPositiveButton(R.string.ok) { _, _ -> }
.create()
.show()
}
PrefsManager.getInstance().appendCid(ctx.card.cidDescription)
}
private fun isNewCid(cid: String): Boolean = !PrefsManager.getInstance().getAllCids().contains(cid)
private fun requestVerifyAndGetInfo() {
if (UtilHelper.isOnline(context as Activity)) {
if ((ctx.card!!.isOnlineVerified == null || !ctx.card!!.isOnlineVerified)) {

View file

@ -151,6 +151,8 @@
<string name="btn_details">Details</string>
<string name="btn_new_scan">New scan</string>
<string name="verifying_in_blockchain">Verifying in blockchain…</string>
<string name="card_signed_transactions_warning">Warning: This card has been already topped up and signed transactions in the past.
Consider immediate withdrawal of all funds if you have received this card from an untrusted source.</string>
<!-- CreateNewWalletActivity, PurgeActivity, SignTransactionActivity -->
<string name="now_touch_the_banknote_with_id">Now touch the banknote with ID</string>