Updated on 2026-08-14
This commit is contained in:
parent
cd6da4efe7
commit
7bd746784d
1 changed files with 33 additions and 5 deletions
|
|
@ -1,28 +1,28 @@
|
|||
package com.tangem.presentation.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.nfc.NfcAdapter
|
||||
import android.nfc.Tag
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.Toast
|
||||
import com.tangem.data.network.ServerApiHelper
|
||||
import com.tangem.data.network.model.InfuraResponse
|
||||
|
||||
import com.tangem.data.network.request.ElectrumRequest
|
||||
import com.tangem.data.network.request.InfuraRequest
|
||||
import com.tangem.data.network.task.send_transaction.ConnectTask
|
||||
import com.tangem.data.network.task.send_transaction.ETHRequestTask
|
||||
import com.tangem.domain.cardReader.NfcManager
|
||||
import com.tangem.domain.wallet.Blockchain
|
||||
import com.tangem.domain.wallet.CoinEngineFactory
|
||||
import com.tangem.domain.wallet.LastSignStorage
|
||||
import com.tangem.domain.wallet.TangemCard
|
||||
import com.tangem.wallet.R
|
||||
import org.json.JSONException
|
||||
import java.io.IOException
|
||||
import java.math.BigInteger
|
||||
|
||||
class SendTransactionActivity : AppCompatActivity() {
|
||||
class SendTransactionActivity : AppCompatActivity(), NfcAdapter.ReaderCallback {
|
||||
|
||||
companion object {
|
||||
const val EXTRA_UID: String = "UID"
|
||||
|
|
@ -33,6 +33,7 @@ class SendTransactionActivity : AppCompatActivity() {
|
|||
private var serverApiHelper: ServerApiHelper? = null
|
||||
var card: TangemCard? = null
|
||||
private var tx: String? = null
|
||||
private var nfcManager: NfcManager? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
@ -40,6 +41,8 @@ class SendTransactionActivity : AppCompatActivity() {
|
|||
|
||||
MainActivity.commonInit(applicationContext)
|
||||
|
||||
nfcManager = NfcManager(this, this)
|
||||
|
||||
serverApiHelper = ServerApiHelper()
|
||||
|
||||
val intent = intent
|
||||
|
|
@ -158,4 +161,29 @@ class SendTransactionActivity : AppCompatActivity() {
|
|||
finish()
|
||||
}
|
||||
|
||||
public override fun onResume() {
|
||||
super.onResume()
|
||||
nfcManager!!.onResume()
|
||||
}
|
||||
|
||||
public override fun onPause() {
|
||||
super.onPause()
|
||||
nfcManager!!.onPause()
|
||||
}
|
||||
|
||||
public override fun onStop() {
|
||||
super.onStop()
|
||||
nfcManager!!.onStop()
|
||||
}
|
||||
|
||||
override fun onTagDiscovered(tag: Tag) {
|
||||
try {
|
||||
// Log.w(javaClass.name, "Ignore discovered tag!")
|
||||
nfcManager!!.ignoreTag(tag)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue