|
|
@@ -124,9 +124,22 @@ class DownloadWizardMethodSelectFragment : DownloadWizardActivity.DownloadWizard
|
|
|
processLpaString(text.toString())
|
|
|
}
|
|
|
|
|
|
- private fun processLpaString(s: String) {
|
|
|
- val components = s.split("$")
|
|
|
- if (components.size < 3 || components[0] != "LPA:1") {
|
|
|
+ private fun processLpaString(input: String) {
|
|
|
+ try {
|
|
|
+ val parsed = ActivationCode.fromString(input)
|
|
|
+ state.smdp = parsed.address
|
|
|
+ state.matchingId = parsed.matchingId
|
|
|
+ if (parsed.confirmationCodeRequired) {
|
|
|
+ AlertDialog.Builder(requireContext()).apply {
|
|
|
+ setTitle(R.string.profile_download_required_confirmation_code)
|
|
|
+ setMessage(R.string.profile_download_required_confirmation_code_message)
|
|
|
+ setCancelable(true)
|
|
|
+ setPositiveButton(android.R.string.ok, null)
|
|
|
+ show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gotoNextFragment(DownloadWizardDetailsFragment())
|
|
|
+ } catch (e: IllegalArgumentException) {
|
|
|
AlertDialog.Builder(requireContext()).apply {
|
|
|
setTitle(R.string.profile_download_incorrect_lpa_string)
|
|
|
setMessage(R.string.profile_download_incorrect_lpa_string_message)
|
|
|
@@ -134,11 +147,7 @@ class DownloadWizardMethodSelectFragment : DownloadWizardActivity.DownloadWizard
|
|
|
setNegativeButton(android.R.string.cancel, null)
|
|
|
show()
|
|
|
}
|
|
|
- return
|
|
|
}
|
|
|
- state.smdp = components[1]
|
|
|
- state.matchingId = components[2]
|
|
|
- gotoNextFragment(DownloadWizardDetailsFragment())
|
|
|
}
|
|
|
|
|
|
private class DownloadMethodViewHolder(private val root: View) : ViewHolder(root) {
|