Updated on 2026-08-14
This commit is contained in:
parent
10c0b8e680
commit
452c5511bc
23 changed files with 46 additions and 32 deletions
|
|
@ -3,10 +3,13 @@ package com.tangem;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.support.v7.app.AppCompatDelegate;
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
|
|
||||||
|
import com.tangem.data.db.PINStorage;
|
||||||
import com.tangem.di.DaggerNavigatorComponent;
|
import com.tangem.di.DaggerNavigatorComponent;
|
||||||
import com.tangem.di.DaggerNetworkComponent;
|
import com.tangem.di.DaggerNetworkComponent;
|
||||||
import com.tangem.di.NavigatorComponent;
|
import com.tangem.di.NavigatorComponent;
|
||||||
import com.tangem.di.NetworkComponent;
|
import com.tangem.di.NetworkComponent;
|
||||||
|
import com.tangem.domain.cardReader.Firmwares;
|
||||||
|
import com.tangem.domain.wallet.Issuer;
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
|
||||||
|
|
@ -38,6 +41,16 @@ public class App extends Application {
|
||||||
|
|
||||||
networkComponent = DaggerNetworkComponent.create();
|
networkComponent = DaggerNetworkComponent.create();
|
||||||
navigatorComponent = buildNavigatorComponent();
|
navigatorComponent = buildNavigatorComponent();
|
||||||
|
|
||||||
|
// common init
|
||||||
|
if (PINStorage.needInit())
|
||||||
|
PINStorage.init(getApplicationContext());
|
||||||
|
|
||||||
|
if (Issuer.needInit())
|
||||||
|
Issuer.init(getApplicationContext());
|
||||||
|
|
||||||
|
if (Firmwares.needInit())
|
||||||
|
Firmwares.init(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ public class ReadCardInfoTask extends Thread {
|
||||||
private static String lastRead_UID;
|
private static String lastRead_UID;
|
||||||
|
|
||||||
public static void resetLastReadInfo() {
|
public static void resetLastReadInfo() {
|
||||||
lastRead_UID="";
|
lastRead_UID = "";
|
||||||
lastRead_Encryption=null;
|
lastRead_Encryption = null;
|
||||||
lastRead_UnsuccessfullPINs.clear();
|
lastRead_UnsuccessfullPINs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class ConfirmPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_confirm_payment)
|
setContentView(R.layout.activity_confirm_payment)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class CreateNewWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback,
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_create_new_wallet)
|
setContentView(R.layout.activity_create_new_wallet)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class EmptyWalletActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_empty_wallet)
|
setContentView(R.layout.activity_empty_wallet)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class LoadedWalletActivity : AppCompatActivity() {
|
||||||
|
|
||||||
App.getNavigatorComponent().inject(this)
|
App.getNavigatorComponent().inject(this)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
if (intent.extras!!.containsKey(NfcAdapter.EXTRA_TAG)) {
|
if (intent.extras!!.containsKey(NfcAdapter.EXTRA_TAG)) {
|
||||||
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
|
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,16 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
|
||||||
|
|
||||||
fun callingIntent(context: Context) = Intent(context, MainActivity::class.java)
|
fun callingIntent(context: Context) = Intent(context, MainActivity::class.java)
|
||||||
|
|
||||||
fun commonInit(context: Context) {
|
// fun commonInit(context: Context) {
|
||||||
if (PINStorage.needInit())
|
// if (PINStorage.needInit())
|
||||||
PINStorage.init(context)
|
// PINStorage.init(context)
|
||||||
|
//
|
||||||
if (Issuer.needInit())
|
// if (Issuer.needInit())
|
||||||
Issuer.init(context)
|
// Issuer.init(context)
|
||||||
|
//
|
||||||
if (Firmwares.needInit())
|
// if (Firmwares.needInit())
|
||||||
Firmwares.init(context)
|
// Firmwares.init(context)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private var nfcManager: NfcManager? = null
|
private var nfcManager: NfcManager? = null
|
||||||
|
|
@ -101,7 +101,7 @@ class MainActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoco
|
||||||
|
|
||||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
|
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
|
||||||
|
|
||||||
commonInit(applicationContext)
|
// commonInit(applicationContext)
|
||||||
|
|
||||||
setNfcAdapterReaderCallback(this)
|
setNfcAdapterReaderCallback(this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class PinRequestActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Finge
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_pin_request)
|
setContentView(R.layout.activity_pin_request)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class PinSaveActivity : AppCompatActivity(), FingerprintHelper.FingerprintHelper
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_pin_save)
|
setContentView(R.layout.activity_pin_save)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
usePIN2 = intent.getBooleanExtra("PIN2", false)
|
usePIN2 = intent.getBooleanExtra("PIN2", false)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class PinSwapActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProt
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_pin_swap)
|
setContentView(R.layout.activity_pin_swap)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class PrepareCryptonitOtherApiWithdrawalActivity : AppCompatActivity(), NfcAdapt
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_prepare_cryptonit_other_api_withdrawal)
|
setContentView(R.layout.activity_prepare_cryptonit_other_api_withdrawal)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ class PrepareCryptonitOtherApiWithdrawalActivity : AppCompatActivity(), NfcAdapt
|
||||||
tvCurrency.text = engine!!.balanceCurrency
|
tvCurrency.text = engine!!.balanceCurrency
|
||||||
|
|
||||||
etAmount.setText(engine.convertToAmount(engine.convertToInternalAmount(ctx.card!!.denomination)).toValueString())
|
etAmount.setText(engine.convertToAmount(engine.convertToInternalAmount(ctx.card!!.denomination)).toValueString())
|
||||||
etAmount.filters=engine.amountInputFilters
|
etAmount.filters = engine.amountInputFilters
|
||||||
|
|
||||||
// set listeners
|
// set listeners
|
||||||
btnLoad.setOnClickListener {
|
btnLoad.setOnClickListener {
|
||||||
|
|
@ -66,7 +66,7 @@ class PrepareCryptonitOtherApiWithdrawalActivity : AppCompatActivity(), NfcAdapt
|
||||||
val strAmount: String = etAmount.text.toString().replace(",", ".")
|
val strAmount: String = etAmount.text.toString().replace(",", ".")
|
||||||
// if (!engine.checkAmount(card, strAmount))
|
// if (!engine.checkAmount(card, strAmount))
|
||||||
// etAmount.error = getString(R.string.unknown_amount_format)
|
// etAmount.error = getString(R.string.unknown_amount_format)
|
||||||
var dblAmount: Double = strAmount.toDouble()
|
val dblAmount: Double = strAmount.toDouble()
|
||||||
|
|
||||||
rlProgressBar.visibility = View.VISIBLE
|
rlProgressBar.visibility = View.VISIBLE
|
||||||
tvProgressDescription.text = getString(R.string.cryptonit_request_withdrawal)
|
tvProgressDescription.text = getString(R.string.cryptonit_request_withdrawal)
|
||||||
|
|
@ -177,8 +177,8 @@ class PrepareCryptonitOtherApiWithdrawalActivity : AppCompatActivity(), NfcAdapt
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
if( resultCode == Activity.RESULT_OK && data != null && data.extras!!.containsKey("QRCode") ) {
|
if (resultCode == Activity.RESULT_OK && data != null && data.extras!!.containsKey("QRCode")) {
|
||||||
when(requestCode) {
|
when (requestCode) {
|
||||||
REQUEST_CODE_SCAN_QR_KEY -> {
|
REQUEST_CODE_SCAN_QR_KEY -> {
|
||||||
cryptonit!!.key = data.getStringExtra("QRCode")
|
cryptonit!!.key = data.getStringExtra("QRCode")
|
||||||
tvKey!!.text = cryptonit!!.key
|
tvKey!!.text = cryptonit!!.key
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class PrepareCryptonitWithdrawalActivity : AppCompatActivity(), NfcAdapter.Reade
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_prepare_cryptonit_withdrawal)
|
setContentView(R.layout.activity_prepare_cryptonit_withdrawal)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class PrepareKrakenWithdrawalActivity : AppCompatActivity(), NfcAdapter.ReaderCa
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_prepare_kraken_withdrawal)
|
setContentView(R.layout.activity_prepare_kraken_withdrawal)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class PreparePaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_prepare_payment)
|
setContentView(R.layout.activity_prepare_payment)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class PurgeActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, CardProtoc
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
ctx = TangemContext.loadFromBundle(this, intent.extras)
|
ctx = TangemContext.loadFromBundle(this, intent.extras)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_send_transaction)
|
setContentView(R.layout.activity_send_transaction)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class SignPaymentActivity : AppCompatActivity(), NfcAdapter.ReaderCallback, Card
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_sign_payment)
|
setContentView(R.layout.activity_sign_payment)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
|
|
||||||
nfcManager = NfcManager(this, this)
|
nfcManager = NfcManager(this, this)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class VerifyCardActivity : AppCompatActivity() {
|
||||||
|
|
||||||
App.getNavigatorComponent().inject(this)
|
App.getNavigatorComponent().inject(this)
|
||||||
|
|
||||||
MainActivity.commonInit(applicationContext)
|
// MainActivity.commonInit(applicationContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ public class WaitSecurityDelayDialog extends DialogFragment {
|
||||||
|
|
||||||
if (msec == 0) {
|
if (msec == 0) {
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
|
// TODO java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.FragmentTransaction android.support.v4.app.FragmentManager.beginTransaction()' on a null object reference
|
||||||
instance.dismiss();
|
instance.dismiss();
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
0
app/src/main/res/drawable/ic_content_copy_black_24dp.xml
Executable file → Normal file
0
app/src/main/res/drawable/ic_content_copy_black_24dp.xml
Executable file → Normal file
0
app/src/main/res/drawable/ic_nfc_white_24dp.xml
Executable file → Normal file
0
app/src/main/res/drawable/ic_nfc_white_24dp.xml
Executable file → Normal file
0
app/src/main/res/drawable/ic_wrench_white_24dp.xml
Executable file → Normal file
0
app/src/main/res/drawable/ic_wrench_white_24dp.xml
Executable file → Normal file
0
gradlew
vendored
Executable file → Normal file
0
gradlew
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue