Compare commits

...

2 commits

3 changed files with 9 additions and 12 deletions

View file

@ -34,6 +34,7 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
private val barcodeScannerLauncher = registerForActivityResult(ScanContract()) { result -> private val barcodeScannerLauncher = registerForActivityResult(ScanContract()) { result ->
result.contents?.let { content -> result.contents?.let { content ->
Log.d(TAG, content)
val components = content.split("$") val components = content.split("$")
if (components.size < 3 || components[0] != "LPA:1") return@registerForActivityResult if (components.size < 3 || components[0] != "LPA:1") return@registerForActivityResult
binding.profileDownloadServer.editText?.setText(components[1]) binding.profileDownloadServer.editText?.setText(components[1])
@ -100,14 +101,7 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
} }
} }
val code = binding.profileDownloadCode.editText!!.let { val code = binding.profileDownloadCode.editText!!.text.toString().trim()
it.text.toString().trim().apply {
if (isEmpty()) {
it.requestFocus()
return@startDownloadProfile
}
}
}
downloading = true downloading = true

View file

@ -10,7 +10,6 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
class DownloadProfileWorker { class DownloadProfileWorker {
private static final Logger LOG = Logger.getLogger(DownloadProfileWorker.class.getName()); private static final Logger LOG = Logger.getLogger(DownloadProfileWorker.class.getName());
@ -42,7 +41,7 @@ class DownloadProfileWorker {
String serverAddress; String serverAddress;
if(matchingId.contains("$")){ if(matchingId.contains("$")){
//Its activation code //Its activation code
String[] acParts = matchingId.split("\\$"); String[] acParts = matchingId.split("\\$", -1);
if(acParts.length<3 ) if(acParts.length<3 )
throw new RuntimeException("Invalid ActivationCode format"); throw new RuntimeException("Invalid ActivationCode format");

View file

@ -30,7 +30,9 @@ public class ApduTransmitter {
LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDU response: " + apduResponse); LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDU response: " + apduResponse);
} }
return apduResponse; // Last 2 bytes are the status code (should be 0x9000)
// TODO: Do this properly
return apduResponse.substring(0, apduResponse.length() - 4);
} }
String transmitApdus(List<String> apdus) { String transmitApdus(List<String> apdus) {
@ -46,7 +48,9 @@ public class ApduTransmitter {
LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDUs response: " + apduResponse); LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Transmit APDUs response: " + apduResponse);
} }
return apduResponse; // Last 2 bytes are the status code (should be 0x9000)
// TODO: Do this properly
return apduResponse.substring(0, apduResponse.length() - 4);
} }
void addApduTransmittedListener(ApduTransmittedListener apduTransmittedListener) { void addApduTransmittedListener(ApduTransmittedListener apduTransmittedListener) {