Compare commits
2 commits
6b1056d907
...
0d2bdb3868
Author | SHA1 | Date | |
---|---|---|---|
0d2bdb3868 | |||
b008115ed1 |
3 changed files with 9 additions and 12 deletions
|
@ -34,6 +34,7 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
|
|||
|
||||
private val barcodeScannerLauncher = registerForActivityResult(ScanContract()) { result ->
|
||||
result.contents?.let { content ->
|
||||
Log.d(TAG, content)
|
||||
val components = content.split("$")
|
||||
if (components.size < 3 || components[0] != "LPA:1") return@registerForActivityResult
|
||||
binding.profileDownloadServer.editText?.setText(components[1])
|
||||
|
@ -100,14 +101,7 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
|
|||
}
|
||||
}
|
||||
|
||||
val code = binding.profileDownloadCode.editText!!.let {
|
||||
it.text.toString().trim().apply {
|
||||
if (isEmpty()) {
|
||||
it.requestFocus()
|
||||
return@startDownloadProfile
|
||||
}
|
||||
}
|
||||
}
|
||||
val code = binding.profileDownloadCode.editText!!.text.toString().trim()
|
||||
|
||||
downloading = true
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
class DownloadProfileWorker {
|
||||
private static final Logger LOG = Logger.getLogger(DownloadProfileWorker.class.getName());
|
||||
|
@ -42,7 +41,7 @@ class DownloadProfileWorker {
|
|||
String serverAddress;
|
||||
if(matchingId.contains("$")){
|
||||
//Its activation code
|
||||
String[] acParts = matchingId.split("\\$");
|
||||
String[] acParts = matchingId.split("\\$", -1);
|
||||
if(acParts.length<3 )
|
||||
throw new RuntimeException("Invalid ActivationCode format");
|
||||
|
||||
|
|
|
@ -30,7 +30,9 @@ public class ApduTransmitter {
|
|||
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) {
|
||||
|
@ -46,7 +48,9 @@ public class ApduTransmitter {
|
|||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue