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) =
|
private fun operationToLocalizedText(operation: ProfileManagementOperation?) =
|
||||||
root.context.getText(
|
root.context.getString(when (operation) {
|
||||||
when (operation) {
|
|
||||||
ProfileManagementOperation.Install -> R.string.profile_notification_operation_download
|
ProfileManagementOperation.Install -> R.string.profile_notification_operation_download
|
||||||
ProfileManagementOperation.Delete -> R.string.profile_notification_operation_delete
|
ProfileManagementOperation.Delete -> R.string.profile_notification_operation_delete
|
||||||
ProfileManagementOperation.Enable -> R.string.profile_notification_operation_enable
|
ProfileManagementOperation.Enable -> R.string.profile_notification_operation_enable
|
||||||
ProfileManagementOperation.Disable -> R.string.profile_notification_operation_disable
|
ProfileManagementOperation.Disable -> R.string.profile_notification_operation_disable
|
||||||
|
else -> throw IllegalStateException("Unknown operation: $operation")
|
||||||
})
|
})
|
||||||
|
|
||||||
fun updateNotification(value: LocalProfileNotificationWrapper) {
|
fun updateNotification(value: LocalProfileNotificationWrapper) {
|
||||||
|
|
|
@ -9,21 +9,21 @@ private val invalidDPAddresses = setOf(
|
||||||
"testrootsmds.example.com",
|
"testrootsmds.example.com",
|
||||||
)
|
)
|
||||||
|
|
||||||
class EuiccConfiguredAddresses(defaultDPAddress: String, rootDSAddress: String) {
|
data class EuiccConfiguredAddresses(
|
||||||
val defaultDPAddress = defaultDPAddress.takeUnless(::isInvalidDPAddress)
|
val defaultDPAddress: String,
|
||||||
val rootDSAddress = rootDSAddress.takeUnless(::isInvalidDSAddress)
|
val rootDSAddress: String
|
||||||
|
) {
|
||||||
val discoverable: Boolean
|
val discoverable: Boolean
|
||||||
get() = !defaultDPAddress.isNullOrBlank() || !rootDSAddress.isNullOrBlank()
|
get() = isValidDPAddress(defaultDPAddress) ||
|
||||||
|
isValidDSAddress(rootDSAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isInvalidDPAddress(address: String?): Boolean {
|
private fun isValidDPAddress(address: String): Boolean {
|
||||||
if (address.isNullOrBlank()) return true
|
return address.isNotBlank() && Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||||
return !Patterns.DOMAIN_NAME.matcher(address).matches()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isInvalidDSAddress(address: String?): Boolean {
|
private fun isValidDSAddress(address: String): Boolean {
|
||||||
if (address.isNullOrBlank()) return true
|
if (address.isBlank()) return false
|
||||||
if (address in invalidDPAddresses) return true
|
if (address in invalidDPAddresses) return false
|
||||||
return !Patterns.DOMAIN_NAME.matcher(address).matches()
|
return Patterns.DOMAIN_NAME.matcher(address).matches()
|
||||||
}
|
}
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue