Compare commits
No commits in common. "0d2bdb3868ed8369d855e221933bb6f27b278dc8" and "6b1056d9072472e2a46c1c396625431bc54a8112" have entirely different histories.
0d2bdb3868
...
6b1056d907
3 changed files with 12 additions and 9 deletions
|
@ -34,7 +34,6 @@ 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])
|
||||||
|
@ -101,7 +100,14 @@ class ProfileDownloadFragment : DialogFragment(), EuiccFragmentMarker, Toolbar.O
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val code = binding.profileDownloadCode.editText!!.text.toString().trim()
|
val code = binding.profileDownloadCode.editText!!.let {
|
||||||
|
it.text.toString().trim().apply {
|
||||||
|
if (isEmpty()) {
|
||||||
|
it.requestFocus()
|
||||||
|
return@startDownloadProfile
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
downloading = true
|
downloading = true
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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());
|
||||||
|
@ -41,7 +42,7 @@ class DownloadProfileWorker {
|
||||||
String serverAddress;
|
String serverAddress;
|
||||||
if(matchingId.contains("$")){
|
if(matchingId.contains("$")){
|
||||||
//Its activation code
|
//Its activation code
|
||||||
String[] acParts = matchingId.split("\\$", -1);
|
String[] acParts = matchingId.split("\\$");
|
||||||
if(acParts.length<3 )
|
if(acParts.length<3 )
|
||||||
throw new RuntimeException("Invalid ActivationCode format");
|
throw new RuntimeException("Invalid ActivationCode format");
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last 2 bytes are the status code (should be 0x9000)
|
return apduResponse;
|
||||||
// TODO: Do this properly
|
|
||||||
return apduResponse.substring(0, apduResponse.length() - 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String transmitApdus(List<String> apdus) {
|
String transmitApdus(List<String> apdus) {
|
||||||
|
@ -48,9 +46,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last 2 bytes are the status code (should be 0x9000)
|
return apduResponse;
|
||||||
// TODO: Do this properly
|
|
||||||
return apduResponse.substring(0, apduResponse.length() - 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addApduTransmittedListener(ApduTransmittedListener apduTransmittedListener) {
|
void addApduTransmittedListener(ApduTransmittedListener apduTransmittedListener) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue