move constants to own file

This commit is contained in:
Michele Balistreri 2019-11-01 10:59:54 +03:00
parent 494126e985
commit 900abe0db5
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
7 changed files with 20 additions and 17 deletions

View File

@ -7,8 +7,6 @@ import im.status.keycard.io.CardChannel
import im.status.keycard.io.CardListener
import java.util.*
const val REQ_INTERACTIVE_SCRIPT = 0x01
class CardScriptExecutor(activity: Activity) : CardListener {
class Context(val mainActivity: Activity) {
var cardChannel: CardChannel? = null

View File

@ -0,0 +1,12 @@
package im.status.keycard.connect.data
const val PAIRING_ACTIVITY_PASSWORD = "pairingPassword"
const val PIN_ACTIVITY_ATTEMPTS = "remainingAttempts"
const val PIN_ACTIVITY_CARD_UID = "cardUID"
const val INIT_ACTIVITY_PIN = "initPIN"
const val INIT_ACTIVITY_PUK = "initPUK"
const val INIT_ACTIVITY_PAIRING = "initPairing"
const val REQ_INTERACTIVE_SCRIPT = 0x01

View File

@ -9,7 +9,6 @@ import im.status.keycard.applet.Pairing
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKeys
object PairingManager {
private lateinit var sharedPreferences: SharedPreferences

View File

@ -11,11 +11,9 @@ import android.util.Base64.NO_PADDING
import android.util.Base64.NO_WRAP
import android.widget.TextView
import im.status.keycard.connect.R
const val INIT_ACTIVITY_PIN = "initPIN"
const val INIT_ACTIVITY_PUK = "initPUK"
const val INIT_ACTIVITY_PAIRING = "initPairing"
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
import im.status.keycard.connect.data.INIT_ACTIVITY_PUK
class InitActivity : AppCompatActivity() {
private lateinit var pin: String

View File

@ -8,6 +8,7 @@ import android.content.Intent
import im.status.keycard.connect.R
import im.status.keycard.connect.card.*
import im.status.keycard.connect.data.PairingManager
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
class MainActivity : AppCompatActivity() {
private lateinit var cardManager: NFCCardManager

View File

@ -8,9 +8,8 @@ import android.widget.EditText
import android.widget.TextView
import im.status.keycard.connect.R
import im.status.keycard.connect.data.PINCache
const val PIN_ACTIVITY_ATTEMPTS = "remainingAttempts"
const val PIN_ACTIVITY_CARD_UID = "cardUID"
import im.status.keycard.connect.data.PIN_ACTIVITY_ATTEMPTS
import im.status.keycard.connect.data.PIN_ACTIVITY_CARD_UID
class PINActivity : AppCompatActivity() {
private lateinit var cardUID: ByteArray

View File

@ -7,8 +7,7 @@ import android.view.View
import android.widget.EditText
import android.content.Intent
import im.status.keycard.connect.R
const val PAIRING_ACTIVITY_PASSWORD = "pairingPassword"
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
class PairingActivity : AppCompatActivity() {
@ -19,10 +18,7 @@ class PairingActivity : AppCompatActivity() {
fun ok(view: View) {
val intent = Intent()
intent.putExtra(
PAIRING_ACTIVITY_PASSWORD, findViewById<EditText>(
R.id.passwordText
).text.toString())
intent.putExtra(PAIRING_ACTIVITY_PASSWORD, findViewById<EditText>(R.id.passwordText).text.toString())
setResult(Activity.RESULT_OK, intent)
finish()
}