forked from PeterCxy/OpenEUICC
Compare commits
2 commits
d3d9a6e5bc
...
ea39fa2ca6
Author | SHA1 | Date | |
---|---|---|---|
ea39fa2ca6 | |||
cbf31c1116 |
3 changed files with 21 additions and 21 deletions
|
@ -164,13 +164,13 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
|||
}
|
||||
|
||||
|
||||
private fun operationToLocalizedText(operation: ProfileManagementOperation) =
|
||||
root.context.getText(
|
||||
when (operation) {
|
||||
private fun operationToLocalizedText(operation: ProfileManagementOperation?) =
|
||||
root.context.getString(when (operation) {
|
||||
ProfileManagementOperation.Install -> R.string.profile_notification_operation_download
|
||||
ProfileManagementOperation.Delete -> R.string.profile_notification_operation_delete
|
||||
ProfileManagementOperation.Enable -> R.string.profile_notification_operation_enable
|
||||
ProfileManagementOperation.Disable -> R.string.profile_notification_operation_disable
|
||||
else -> throw IllegalStateException("Unknown operation: $operation")
|
||||
})
|
||||
|
||||
fun updateNotification(value: LocalProfileNotificationWrapper) {
|
||||
|
|
|
@ -9,21 +9,21 @@ private val invalidDPAddresses = setOf(
|
|||
"testrootsmds.example.com",
|
||||
)
|
||||
|
||||
class EuiccConfiguredAddresses(defaultDPAddress: String, rootDSAddress: String) {
|
||||
val defaultDPAddress = defaultDPAddress.takeUnless(::isInvalidDPAddress)
|
||||
val rootDSAddress = rootDSAddress.takeUnless(::isInvalidDSAddress)
|
||||
|
||||
data class EuiccConfiguredAddresses(
|
||||
val defaultDPAddress: String,
|
||||
val rootDSAddress: String
|
||||
) {
|
||||
val discoverable: Boolean
|
||||
get() = !defaultDPAddress.isNullOrBlank() || !rootDSAddress.isNullOrBlank()
|
||||
get() = isValidDPAddress(defaultDPAddress) ||
|
||||
isValidDSAddress(rootDSAddress)
|
||||
}
|
||||
|
||||
private fun isInvalidDPAddress(address: String?): Boolean {
|
||||
if (address.isNullOrBlank()) return true
|
||||
return !Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||
private fun isValidDPAddress(address: String): Boolean {
|
||||
return address.isNotBlank() && Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||
}
|
||||
|
||||
private fun isInvalidDSAddress(address: String?): Boolean {
|
||||
if (address.isNullOrBlank()) return true
|
||||
if (address in invalidDPAddresses) return true
|
||||
return !Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||
private fun isValidDSAddress(address: String): Boolean {
|
||||
if (address.isBlank()) return false
|
||||
if (address in invalidDPAddresses) return false
|
||||
return Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||
}
|
|
@ -2,7 +2,7 @@ package net.typeblog.lpac_jni
|
|||
|
||||
data class LocalProfileNotification(
|
||||
val seqNumber: Long,
|
||||
val profileManagementOperation: ProfileManagementOperation,
|
||||
val profileManagementOperation: ProfileManagementOperation?,
|
||||
val notificationAddress: String,
|
||||
val iccid: String,
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue