fix compilation

This commit is contained in:
Michele Balistreri 2019-11-01 11:56:47 +03:00
parent 900abe0db5
commit ae7c937d9e
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
7 changed files with 17 additions and 23 deletions

View File

@ -2,11 +2,8 @@ package im.status.keycard.connect.card
import android.app.Activity
import android.content.Intent
import im.status.keycard.connect.ui.INIT_ACTIVITY_PAIRING
import im.status.keycard.connect.ui.INIT_ACTIVITY_PIN
import im.status.keycard.connect.ui.INIT_ACTIVITY_PUK
import im.status.keycard.connect.data.*
import im.status.keycard.connect.ui.InitActivity
import im.status.keycard.connect.data.PairingManager
import im.status.keycard.io.APDUException
import java.io.IOException

View File

@ -3,8 +3,9 @@ package im.status.keycard.connect.card
import android.app.Activity
import android.content.Intent
import im.status.keycard.applet.KeycardCommandSet
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
import im.status.keycard.connect.data.PairingManager
import im.status.keycard.connect.ui.PAIRING_ACTIVITY_PASSWORD
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.PairingActivity
import java.io.IOException

View File

@ -3,9 +3,10 @@ package im.status.keycard.connect.card
import android.app.Activity
import android.content.Intent
import im.status.keycard.connect.ui.PINActivity
import im.status.keycard.connect.ui.PIN_ACTIVITY_ATTEMPTS
import im.status.keycard.connect.ui.PIN_ACTIVITY_CARD_UID
import im.status.keycard.connect.data.PINCache
import im.status.keycard.connect.data.PIN_ACTIVITY_ATTEMPTS
import im.status.keycard.connect.data.PIN_ACTIVITY_CARD_UID
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.io.APDUException
import im.status.keycard.io.WrongPINException
import java.io.IOException
@ -19,8 +20,8 @@ class VerifyPINCommand : CardCommand {
putExtra(PIN_ACTIVITY_CARD_UID, instanceUID)
}
mainActivity.startActivityForResult(intent, REQ_INTERACTIVE_SCRIPT)
return CommandResult.UX_ONGOING
}
@ -34,7 +35,7 @@ class VerifyPINCommand : CardCommand {
if (pin != null) {
try {
cmdSet.verifyPIN(pin).checkAuthOK()
retries = -1;
retries = -1
return CommandResult.OK
} catch (e: WrongPINException) {
PINCache.removePIN(cmdSet.applicationInfo.instanceUID)

View File

@ -25,7 +25,7 @@ class InitActivity : AppCompatActivity() {
setContentView(R.layout.activity_init)
pin = String.format("%06d", Crypto.randomLong(Crypto.PIN_BOUND))
puk = String.format("%012d", Crypto.randomLong(Crypto.PUK_BOUND));
puk = String.format("%012d", Crypto.randomLong(Crypto.PUK_BOUND))
pairing = randomToken(6)
findViewById<TextView>(R.id.pinView).text = pin
@ -33,7 +33,7 @@ class InitActivity : AppCompatActivity() {
findViewById<TextView>(R.id.pairingView).text = pairing
}
fun ok(view: View) {
fun ok(@Suppress("UNUSED_PARAMETER") view: View) {
val intent = Intent()
intent.putExtra(INIT_ACTIVITY_PIN, pin)
intent.putExtra(INIT_ACTIVITY_PUK, puk)
@ -43,7 +43,7 @@ class InitActivity : AppCompatActivity() {
finish()
}
fun cancel(view: View) {
fun cancel(@Suppress("UNUSED_PARAMETER") view: View) {
setResult(Activity.RESULT_CANCELED)
finish()
}

View File

@ -19,7 +19,6 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
PairingManager.init(this)
nfcAdapter = NfcAdapter.getDefaultAdapter(this)
@ -33,16 +32,12 @@ class MainActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
if (this::nfcAdapter.isInitialized) {
nfcAdapter.enableReaderMode(this, this.cardManager,NfcAdapter.FLAG_READER_NFC_A or NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, null)
}
nfcAdapter.enableReaderMode(this, this.cardManager,NfcAdapter.FLAG_READER_NFC_A or NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, null)
}
override fun onPause() {
super.onPause()
if (this::nfcAdapter.isInitialized) {
nfcAdapter.disableReaderMode(this)
}
nfcAdapter.disableReaderMode(this)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

View File

@ -31,7 +31,7 @@ class PINActivity : AppCompatActivity() {
}
}
fun ok(view: View) {
fun ok(@Suppress("UNUSED_PARAMETER") view: View) {
val pinText = findViewById<EditText>(R.id.pinText)
PINCache.putPIN(cardUID, pinText.text.toString())
@ -39,7 +39,7 @@ class PINActivity : AppCompatActivity() {
finish()
}
fun cancel(view: View) {
fun cancel(@Suppress("UNUSED_PARAMETER") view: View) {
setResult(Activity.RESULT_CANCELED)
finish()
}

View File

@ -16,14 +16,14 @@ class PairingActivity : AppCompatActivity() {
setContentView(R.layout.activity_pairing)
}
fun ok(view: View) {
fun ok(@Suppress("UNUSED_PARAMETER") view: View) {
val intent = Intent()
intent.putExtra(PAIRING_ACTIVITY_PASSWORD, findViewById<EditText>(R.id.passwordText).text.toString())
setResult(Activity.RESULT_OK, intent)
finish()
}
fun cancel(view: View) {
fun cancel(@Suppress("UNUSED_PARAMETER") view: View) {
setResult(Activity.RESULT_CANCELED)
finish()
}