Updated on 2026-08-14
This commit is contained in:
parent
77c2ff30e5
commit
42b6efa391
9 changed files with 172 additions and 190 deletions
|
|
@ -51,7 +51,7 @@ public class LogFileProvider extends ContentProvider {
|
|||
Log.v(LOG_TAG,
|
||||
"Called with uri: '" + uri + "'." + uri.getLastPathSegment());
|
||||
|
||||
// Check incoming Uri against the matcher
|
||||
// check incoming Uri against the matcher
|
||||
switch (uriMatcher.match(uri)) {
|
||||
|
||||
// If it returns 1 - then it matches the Uri defined in onCreate
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ public class Logger {
|
|||
// //Checks if the app has permission to write to device storage
|
||||
// //If the app does not has permission then the user will be prompted to grant permissions
|
||||
// public static void verifyStoragePermissions(Activity activity) {
|
||||
// // Check if we have write permission
|
||||
// // check if we have write permission
|
||||
// int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
//
|
||||
// if (permission != PackageManager.PERMISSION_GRANTED) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class BalanceValidator {
|
|||
}
|
||||
}
|
||||
|
||||
public void Check(TangemContext ctx, Boolean attest) {
|
||||
public void check(TangemContext ctx, Boolean attest) {
|
||||
firstLine = "Verification failed";
|
||||
secondLine = "";
|
||||
TangemCard card = ctx.getCard();
|
||||
|
|
|
|||
|
|
@ -64,14 +64,10 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
val TAG: String = LoadedWallet::class.java.simpleName
|
||||
}
|
||||
|
||||
private lateinit var ctx: TangemContext
|
||||
private lateinit var nfcManager: NfcManager
|
||||
|
||||
private var serverApiCommon: ServerApiCommon = ServerApiCommon()
|
||||
private var serverApiTangem: ServerApiTangem = ServerApiTangem()
|
||||
|
||||
|
||||
private lateinit var ctx: TangemContext
|
||||
|
||||
private var lastTag: Tag? = null
|
||||
private var lastReadSuccess = true
|
||||
private var verifyCardTask: VerifyCardTask? = null
|
||||
|
|
@ -80,24 +76,37 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
private var newPIN = ""
|
||||
private var newPIN2 = ""
|
||||
private var cardProtocol: CardProtocol? = null
|
||||
private val inactiveColor: ColorStateList by lazy { resources.getColorStateList(R.color.btn_dark) }
|
||||
private val activeColor: ColorStateList by lazy { resources.getColorStateList(R.color.colorAccent) }
|
||||
private val inactiveColor: ColorStateList by lazy {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
resources.getColorStateList(R.color.btn_dark, activity?.theme)
|
||||
else
|
||||
@Suppress("DEPRECATION")
|
||||
resources.getColorStateList(R.color.btn_dark)
|
||||
}
|
||||
private val activeColor: ColorStateList by lazy {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
resources.getColorStateList(R.color.colorAccent, activity?.theme)
|
||||
else
|
||||
@Suppress("DEPRECATION")
|
||||
resources.getColorStateList(R.color.colorAccent)
|
||||
}
|
||||
private var requestCounter: Int = 0
|
||||
set(value) {
|
||||
field = value
|
||||
LOG.i(TAG, "requestCounter, set $field")
|
||||
if (field <= 0) {
|
||||
LOG.e(TAG, "+++++++++++ FINISH REFRESH")
|
||||
if (srl != null && srl.isRefreshing) srl.isRefreshing = false
|
||||
//updateViews()
|
||||
} else if (srl != null && !srl.isRefreshing) srl.isRefreshing = true
|
||||
if (srl != null && srl.isRefreshing)
|
||||
srl.isRefreshing = false
|
||||
} else if (srl != null && !srl.isRefreshing)
|
||||
srl.isRefreshing = true
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ctx = TangemContext.loadFromBundle(activity, activity?.intent?.extras)
|
||||
|
||||
nfcManager = NfcManager(activity, this)
|
||||
nfcManager = NfcManager(activity!!, this)
|
||||
lifecycle.addObserver(NfcLifecycleObserver(nfcManager))
|
||||
|
||||
lastTag = activity?.intent?.getParcelableExtra(Constant.EXTRA_LAST_DISCOVERED_TAG)
|
||||
|
|
@ -141,7 +150,7 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
getString(R.string.in_app) -> {
|
||||
try {
|
||||
val engine = CoinEngineFactory.create(ctx)
|
||||
val intent = Intent(Intent.ACTION_VIEW, engine!!.shareWalletUri)
|
||||
val intent = Intent(Intent.ACTION_VIEW, engine?.shareWalletUri)
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT)
|
||||
startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
|
|
@ -561,7 +570,7 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
} else {
|
||||
val validator = BalanceValidator()
|
||||
// TODO why attest=false?
|
||||
validator.Check(ctx, false)
|
||||
validator.check(ctx, false)
|
||||
context?.let { ContextCompat.getColor(it, validator.color) }?.let { tvBalanceLine1.setTextColor(it) }
|
||||
tvBalanceLine1.text = validator.firstLine
|
||||
tvBalanceLine2.text = validator.getSecondLine(false)
|
||||
|
|
@ -607,10 +616,6 @@ class LoadedWallet : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback
|
|||
btnExtract.isEnabled = false
|
||||
btnExtract.backgroundTintList = inactiveColor
|
||||
}
|
||||
|
||||
// //TODO why ???
|
||||
// ctx.error = null
|
||||
// ctx.message = null
|
||||
}
|
||||
|
||||
private fun refresh() {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class VerifyCard : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback {
|
|||
super.onCreate(savedInstanceState)
|
||||
ctx = TangemContext.loadFromBundle(activity, activity?.intent?.extras)
|
||||
|
||||
nfcManager = NfcManager(activity, this)
|
||||
nfcManager = NfcManager(activity!!, this)
|
||||
lifecycle.addObserver(NfcLifecycleObserver(nfcManager))
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class VerifyCard : androidx.fragment.app.Fragment(), NfcAdapter.ReaderCallback {
|
|||
|
||||
override fun onTagDiscovered(tag: Tag?) {
|
||||
try {
|
||||
nfcManager.ignoreTag(tag)
|
||||
nfcManager.ignoreTag(tag!!)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue