-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ooni test descriptors. #275
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we should remove Defaults descriptors all together. If we don't have them anymore, we don't need the extra complexity. That means:
- No need to keep both
Descriptor
andInstalledTestDescriptorModel
classes Descriptor.Source
is not neededDefaultTestDescriptor
is not neededGetDefaultTestDescriptors
is not needed- Only
isDefault()
method is needed, theisInstalledNonDefaultDescriptor()
should just be!isDefault()
.
That should simplify a lot of the existing code.
@@ -53,6 +58,21 @@ data class InstalledTestDescriptorModel( | |||
|
|||
val isExpired get() = expirationDate != null && expirationDate < LocalDateTime.now() | |||
|
|||
val isDefaultTestDescriptor get() = id.value in 10470..10474 // TODO(aanorbel): switch to OONI reserved namespace | |||
|
|||
val key get() = if (isDefaultTestDescriptor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more like a settings key now no? Just to make it clear why we still need this. Because for all other purposes now we can use the ID.
Maybe we can keep both Descriptor and InstalledTestDescriptorModel. It may be useful for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug. When you just have the OONI descriptors, and no custom descriptor installed, the pull-to-refresh on the Dashboard screen doesn't seem to work. The refresh icon just says at the top without animation.
} | ||
} | ||
companion object { | ||
fun fromDescriptor(descriptor: Descriptor) = descriptor.source.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This companion object isn't needed, it should return an object of the type Test
, or it should be called something like sourceFromDescriptor
. It's weird that a static factory method only returns a specific field inside its class.
@@ -17,24 +17,11 @@ sealed interface RunSpecification { | |||
|
|||
@Serializable | |||
data class Test( | |||
val source: Source, | |||
val source: InstalledTestDescriptorModel.Id? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this sourceId or descriptorId to avoid confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this should never be null right?
@@ -104,7 +104,6 @@ class ChooseWebsitesViewModel( | |||
RunSpecification.Full( | |||
tests = listOf( | |||
RunSpecification.Test( | |||
source = RunSpecification.Test.Source.Default("websites"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should fetch it from the DB, or hardcode the websites descriptor ID somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this is empty, it can be removed no?
@@ -52,6 +72,10 @@ data class InstalledTestDescriptorModel( | |||
|
|||
val isExpired get() = expirationDate != null && expirationDate < LocalDateTime.now() | |||
|
|||
val isDefaultTestDescriptor get() = id.value in 10470..10474 // TODO(aanorbel): switch to OONI reserved namespace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also check if they are in OoniTest
now.
This will be done eventually but converting to draft for now. https://openobservatory.slack.com/archives/GKGRFHXT7/p1733782481912289?thread_ts=1733329764.355889&cid=GKGRFHXT7 |
Closes #173, #174