Compare commits

..

No commits in common. "ea39fa2ca62739455622ae05056f9481fda2a992" and "d3d9a6e5bc0c00341a5691d30a0b22f98ea189a8" have entirely different histories.

3 changed files with 21 additions and 21 deletions

View file

@ -164,14 +164,14 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
} }
private fun operationToLocalizedText(operation: ProfileManagementOperation?) = private fun operationToLocalizedText(operation: ProfileManagementOperation) =
root.context.getString(when (operation) { root.context.getText(
ProfileManagementOperation.Install -> R.string.profile_notification_operation_download when (operation) {
ProfileManagementOperation.Delete -> R.string.profile_notification_operation_delete ProfileManagementOperation.Install -> R.string.profile_notification_operation_download
ProfileManagementOperation.Enable -> R.string.profile_notification_operation_enable ProfileManagementOperation.Delete -> R.string.profile_notification_operation_delete
ProfileManagementOperation.Disable -> R.string.profile_notification_operation_disable ProfileManagementOperation.Enable -> R.string.profile_notification_operation_enable
else -> throw IllegalStateException("Unknown operation: $operation") ProfileManagementOperation.Disable -> R.string.profile_notification_operation_disable
}) })
fun updateNotification(value: LocalProfileNotificationWrapper) { fun updateNotification(value: LocalProfileNotificationWrapper) {
notification = value notification = value

View file

@ -9,21 +9,21 @@ private val invalidDPAddresses = setOf(
"testrootsmds.example.com", "testrootsmds.example.com",
) )
data class EuiccConfiguredAddresses( class EuiccConfiguredAddresses(defaultDPAddress: String, rootDSAddress: String) {
val defaultDPAddress: String, val defaultDPAddress = defaultDPAddress.takeUnless(::isInvalidDPAddress)
val rootDSAddress: String val rootDSAddress = rootDSAddress.takeUnless(::isInvalidDSAddress)
) {
val discoverable: Boolean val discoverable: Boolean
get() = isValidDPAddress(defaultDPAddress) || get() = !defaultDPAddress.isNullOrBlank() || !rootDSAddress.isNullOrBlank()
isValidDSAddress(rootDSAddress)
} }
private fun isValidDPAddress(address: String): Boolean { private fun isInvalidDPAddress(address: String?): Boolean {
return address.isNotBlank() && Patterns.DOMAIN_NAME.matcher(address).matches() if (address.isNullOrBlank()) return true
return !Patterns.DOMAIN_NAME.matcher(address).matches()
} }
private fun isValidDSAddress(address: String): Boolean { private fun isInvalidDSAddress(address: String?): Boolean {
if (address.isBlank()) return false if (address.isNullOrBlank()) return true
if (address in invalidDPAddresses) return false if (address in invalidDPAddresses) return true
return Patterns.DOMAIN_NAME.matcher(address).matches() return !Patterns.DOMAIN_NAME.matcher(address).matches()
} }

View file

@ -2,7 +2,7 @@ package net.typeblog.lpac_jni
data class LocalProfileNotification( data class LocalProfileNotification(
val seqNumber: Long, val seqNumber: Long,
val profileManagementOperation: ProfileManagementOperation?, val profileManagementOperation: ProfileManagementOperation,
val notificationAddress: String, val notificationAddress: String,
val iccid: String, val iccid: String,
) )