Allow empty Activation Codes for SM-DP+
This commit is contained in:
parent
b008115ed1
commit
0d2bdb3868
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue