diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/wizard/SimplifiedErrorHandling.kt b/app-common/src/main/java/im/angry/openeuicc/ui/wizard/SimplifiedErrorHandling.kt
index 7be35a6..ffac87e 100644
--- a/app-common/src/main/java/im/angry/openeuicc/ui/wizard/SimplifiedErrorHandling.kt
+++ b/app-common/src/main/java/im/angry/openeuicc/ui/wizard/SimplifiedErrorHandling.kt
@@ -1,5 +1,7 @@
package im.angry.openeuicc.ui.wizard
+import androidx.annotation.StringRes
+import im.angry.openeuicc.common.R
import net.typeblog.lpac_jni.LocalProfileAssistant
import org.json.JSONObject
import java.net.NoRouteToHostException
@@ -9,59 +11,27 @@ import java.net.UnknownHostException
import javax.net.ssl.SSLHandshakeException
object SimplifiedErrorHandling {
- enum class ErrorCode {
- // Profile Installed
- ICCIDAlready,
-
- // Insufficient Memory Space
- InsufficientMemorySpace,
-
- // Unsupported Profile
- UnsupportedProfile,
-
- // The card internal error
- CardInternalError,
-
- // EID doesn't match the expected value.
- EIDMismatch,
-
- // Expired The Download order has expired.
- ProfileExpired,
-
- // Profile has not yet been released.
- UnreleasedProfile,
-
- // MatchingID (AC_Token or EventID) is refused.
- MatchingIDRefused,
-
- // Confirmation Code is missing.
- ConfirmationCodeMissing,
-
- // Confirmation Code is refused.
- ConfirmationCodeRefused,
-
- // The maximum number of retries for the Profile download order has been exceeded.
- ConfirmationCodeRetriesExceeded,
-
- // The maximum number of retries for the Profile download order has been exceeded.
- ProfileRetriesExceeded,
-
- // The FQDN is unknown
- UnknownHost,
-
- // The Network Timeout
- NetworkTimeout,
-
- // The network unreachable
- NetworkUnreachable,
-
- // TLS Certificate Error
- TLSCertificateError,
+ enum class ErrorCode(@StringRes val resId: Int) {
+ ICCIDAlready(R.string.download_wizard_error_iccid_already),
+ InsufficientMemory(R.string.download_wizard_error_insufficient_memory),
+ UnsupportedProfile(R.string.download_wizard_error_unsupported_profile),
+ CardInternalError(R.string.download_wizard_error_card_internal_error),
+ EIDMismatch(R.string.download_wizard_error_eid_mismatch),
+ UnreleasedProfile(R.string.download_wizard_error_profile_unreleased),
+ MatchingIDRefused(R.string.download_wizard_error_matching_id_refused),
+ ProfileRetriesExceeded(R.string.download_wizard_error_profile_retries_exceeded),
+ ConfirmationCodeMissing(R.string.download_wizard_error_confirmation_code_missing),
+ ConfirmationCodeRefused(R.string.download_wizard_error_confirmation_code_missing),
+ ProfileExpired(R.string.download_wizard_error_profile_expired),
+ ConfirmationCodeRetriesExceeded(R.string.download_wizard_error_confirmation_code_retries_exceeded),
+ UnknownHost(R.string.download_wizard_error_unknown_hostname),
+ NetworkUnreachable(R.string.download_wizard_error_network_unreachable),
+ TLSCertificateError(R.string.download_wizard_error_tls_certificate)
}
private val httpErrors = buildMap {
// Stage: AuthenticateClient
- put("8.1" to "4.8", ErrorCode.InsufficientMemorySpace)
+ put("8.1" to "4.8", ErrorCode.InsufficientMemory)
put("8.1.1" to "3.8", ErrorCode.EIDMismatch)
put("8.2" to "1.2", ErrorCode.UnreleasedProfile)
put("8.2.6" to "3.8", ErrorCode.MatchingIDRefused)
@@ -71,6 +41,8 @@ object SimplifiedErrorHandling {
put("8.2.7" to "2.2", ErrorCode.ConfirmationCodeMissing)
put("8.2.7" to "3.8", ErrorCode.ConfirmationCodeRefused)
put("8.2.7" to "6.4", ErrorCode.ConfirmationCodeRetriesExceeded)
+
+ // Stage: AuthenticateClient, GetBoundProfilePackage
put("8.8.5" to "4.10", ErrorCode.ProfileExpired)
}
@@ -81,7 +53,7 @@ object SimplifiedErrorHandling {
exc.lastHttpException is SSLHandshakeException -> ErrorCode.TLSCertificateError
exc.lastHttpException is NoRouteToHostException -> ErrorCode.NetworkUnreachable
exc.lastHttpException is PortUnreachableException -> ErrorCode.NetworkUnreachable
- exc.lastHttpException is SocketTimeoutException -> ErrorCode.NetworkTimeout
+ exc.lastHttpException is SocketTimeoutException -> ErrorCode.NetworkUnreachable
else -> null
}
@@ -90,7 +62,7 @@ object SimplifiedErrorHandling {
"ES10B_ERROR_REASON_UNSUPPORTED_REMOTE_OPERATION_TYPE" -> ErrorCode.UnsupportedProfile
"ES10B_ERROR_REASON_UNSUPPORTED_PROFILE_CLASS" -> ErrorCode.UnsupportedProfile
"ES10B_ERROR_REASON_INSTALL_FAILED_DUE_TO_ICCID_ALREADY_EXISTS_ON_EUICC" -> ErrorCode.ICCIDAlready
- "ES10B_ERROR_REASON_INSTALL_FAILED_DUE_TO_INSUFFICIENT_MEMORY_FOR_PROFILE" -> ErrorCode.InsufficientMemorySpace
+ "ES10B_ERROR_REASON_INSTALL_FAILED_DUE_TO_INSUFFICIENT_MEMORY_FOR_PROFILE" -> ErrorCode.InsufficientMemory
"ES10B_ERROR_REASON_INSTALL_FAILED_DUE_TO_INTERRUPTION" -> ErrorCode.CardInternalError
"ES10B_ERROR_REASON_INSTALL_FAILED_DUE_TO_PE_PROCESSING_ERROR" -> ErrorCode.CardInternalError
else -> null
diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml
index 38bb976..e872121 100644
--- a/app-common/src/main/res/values/strings.xml
+++ b/app-common/src/main/res/values/strings.xml
@@ -102,6 +102,21 @@
Last APDU exception:
Save
Diagnostics at %s
+ This eSIM profile is installed, Cannot be reinstalled.
+ Sorry, The remaining capacity of this eSIM chip cannot be used to install this eSIM profile.
+ Sorry, This eSIM profile is unsupported.
+ An error occurred inside the card.
+ This eSIM profile has been installed on another device. Please contact your carrier to reissue this eSIM profile.
+ This eSIM profile has been unreleased. Please contact your carrier to reissue this eSIM profile.
+ This eSIM activation code is invalid. Please contact your carrier for assistance.
+ The maximum number of retries for the eSIM profile has been exceeded.
+ Please enter the confirmation code to continue.
+ The confirmation code you entered is invalid.
+ This eSIM profile has been expired. Please contact your carrier to reissue this eSIM profile.
+ The maximum number of retries for the Confirmation Code has been exceeded.
+ Unknown SM-DP+ address
+ The current network is unreachable
+ TLS certificate error, this eSIM profile is not supported
Logs have been saved to the selected path. Would you like to share the log through another app?