Skip to content

Commit 1323b3b

Browse files
committed
chore: update check for isDefaultTestDescriptor
1 parent f4054c1 commit 1323b3b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/InstalledTestDescriptorModel.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ enum class OoniTest(val id: Long, val key: String) {
4242
private val map = entries.associateBy(OoniTest::id)
4343

4444
fun fromId(id: Long) = map[id]
45+
46+
fun isValidId(id: Long): Boolean {
47+
return entries.any { it.id == id }
48+
}
4549
}
4650
}
4751

@@ -72,7 +76,7 @@ data class InstalledTestDescriptorModel(
7276

7377
val isExpired get() = expirationDate != null && expirationDate < LocalDateTime.now()
7478

75-
val isDefaultTestDescriptor get() = id.value in 10470..10474 // TODO(aanorbel): switch to OONI reserved namespace
79+
val isDefaultTestDescriptor get() = OoniTest.isValidId(id.value)
7680

7781
val key get() = OoniTest.fromId(id.value)?.key ?: id.value.toString()
7882

0 commit comments

Comments
 (0)