Compare commits

...

1 commit

Author SHA1 Message Date
21709e2381
chore: add strings 2025-07-16 12:44:27 +08:00
2 changed files with 38 additions and 51 deletions

View file

@ -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

View file

@ -102,6 +102,21 @@
<string name="download_wizard_diagnostics_last_apdu_exception">Last APDU exception:</string>
<string name="download_wizard_diagnostics_save">Save</string>
<string name="download_wizard_diagnostics_file_template">Diagnostics at %s</string>
<string name="download_wizard_error_iccid_already">This eSIM profile is installed, Cannot be reinstalled.</string>
<string name="download_wizard_error_insufficient_memory">Sorry, The remaining capacity of this eSIM chip cannot be used to install this eSIM profile.</string>
<string name="download_wizard_error_unsupported_profile">Sorry, This eSIM profile is unsupported.</string>
<string name="download_wizard_error_card_internal_error">An error occurred inside the card.</string>
<string name="download_wizard_error_eid_mismatch">This eSIM profile has been installed on another device. Please contact your carrier to reissue this eSIM profile.</string>
<string name="download_wizard_error_profile_unreleased">This eSIM profile has been unreleased. Please contact your carrier to reissue this eSIM profile.</string>
<string name="download_wizard_error_matching_id_refused">This eSIM activation code is invalid. Please contact your carrier for assistance.</string>
<string name="download_wizard_error_profile_retries_exceeded">The maximum number of retries for the eSIM profile has been exceeded.</string>
<string name="download_wizard_error_confirmation_code_missing">Please enter the confirmation code to continue.</string>
<string name="download_wizard_error_confirmation_code_refused">The confirmation code you entered is invalid.</string>
<string name="download_wizard_error_profile_expired">This eSIM profile has been expired. Please contact your carrier to reissue this eSIM profile.</string>
<string name="download_wizard_error_confirmation_code_retries_exceeded">The maximum number of retries for the Confirmation Code has been exceeded.</string>
<string name="download_wizard_error_unknown_hostname">Unknown SM-DP+ address</string>
<string name="download_wizard_error_network_unreachable">The current network is unreachable</string>
<string name="download_wizard_error_tls_certificate">TLS certificate error, this eSIM profile is not supported</string>
<string name="logs_saved_message">Logs have been saved to the selected path. Would you like to share the log through another app?</string>