ActivationCode::fromString -> ActivationCode::parse
All checks were successful
/ build-debug (push) Successful in 4m34s
All checks were successful
/ build-debug (push) Successful in 4m34s
Un-confusion :D
This commit is contained in:
parent
c528962f29
commit
e5753ec2d9
3 changed files with 6 additions and 7 deletions
|
@ -21,7 +21,6 @@ import im.angry.openeuicc.ui.BaseEuiccAccessActivity
|
|||
import im.angry.openeuicc.util.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import net.typeblog.lpac_jni.LocalProfileAssistant
|
||||
|
||||
class DownloadWizardActivity: BaseEuiccAccessActivity() {
|
||||
|
@ -123,7 +122,7 @@ class DownloadWizardActivity: BaseEuiccAccessActivity() {
|
|||
// but that _is_ the desired behavior.
|
||||
val uri = intent.data
|
||||
if (uri?.scheme == "lpa") {
|
||||
val parsed = ActivationCode.fromString(uri.schemeSpecificPart)
|
||||
val parsed = ActivationCode.parse(uri.schemeSpecificPart)
|
||||
state.smdp = parsed.address
|
||||
state.matchingId = parsed.matchingId
|
||||
state.skipMethodSelect = true
|
||||
|
|
|
@ -126,7 +126,7 @@ class DownloadWizardMethodSelectFragment : DownloadWizardActivity.DownloadWizard
|
|||
|
||||
private fun processLpaString(input: String) {
|
||||
try {
|
||||
val parsed = ActivationCode.fromString(input)
|
||||
val parsed = ActivationCode.parse(input)
|
||||
state.smdp = parsed.address
|
||||
state.matchingId = parsed.matchingId
|
||||
if (parsed.confirmationCodeRequired) {
|
||||
|
|
|
@ -2,12 +2,12 @@ package im.angry.openeuicc.util
|
|||
|
||||
data class ActivationCode(
|
||||
val address: String,
|
||||
val matchingId: String? = null,
|
||||
val oid: String? = null,
|
||||
val confirmationCodeRequired: Boolean = false,
|
||||
val matchingId: String?,
|
||||
val oid: String?,
|
||||
val confirmationCodeRequired: Boolean,
|
||||
) {
|
||||
companion object {
|
||||
fun fromString(input: String): ActivationCode {
|
||||
fun parse(input: String): ActivationCode {
|
||||
val components = input.removePrefix("LPA:").split('$')
|
||||
if (components.size < 2 || components[0] != "1") {
|
||||
throw IllegalArgumentException("Invalid activation code format")
|
||||
|
|
Loading…
Add table
Reference in a new issue