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 ->
|
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
|
||||||
|
|
||||||
|
|
|
@ -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");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue