-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from ooni/bootstrap-dw-tests
Run V2: Bootstrap DW tests
- Loading branch information
Showing
30 changed files
with
641 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
composeApp/src/commonMain/kotlin/org/ooni/engine/models/OONIRunDescriptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.ooni.engine.models | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import org.ooni.probe.data.models.NetTest | ||
|
||
/** | ||
* This class represents the response from a fetch request to the OONI API. | ||
* | ||
* @see [https://github.com/ooni/spec/blob/master/backends/bk-005-ooni-run-v2.md] | ||
*/ | ||
@Serializable | ||
data class OONIRunDescriptor( | ||
@SerialName("oonirun_link_id") val oonirunLinkId: Long, | ||
@SerialName("name") val name: String, | ||
@SerialName("short_description") val shortDescription: String, | ||
@SerialName("description") val description: String, | ||
@SerialName("author") val author: String, | ||
@SerialName("nettests") val netTests: List<NetTest>, | ||
@SerialName("name_intl") val nameIntl: Map<String, String>, | ||
@SerialName("short_description_intl") val shortDescriptionIntl: Map<String, String>, | ||
@SerialName("description_intl") val descriptionIntl: Map<String, String>, | ||
@SerialName("icon") val icon: String, | ||
@SerialName("color") val color: String, | ||
@SerialName("animation") val animation: String? = null, | ||
@SerialName("expiration_date") val expirationDate: Instant, | ||
@SerialName("date_created") val dateCreated: Instant, | ||
@SerialName("date_updated") val dateUpdated: Instant, | ||
@SerialName("revision") val revision: String, | ||
@SerialName("is_expired") val isExpired: Boolean, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
composeApp/src/commonMain/kotlin/org/ooni/probe/domain/BootstrapTestDescriptors.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ooni.probe.domain | ||
|
||
import org.ooni.probe.data.models.InstalledTestDescriptorModel | ||
|
||
class BootstrapTestDescriptors( | ||
private val getBootstrapTestDescriptors: suspend () -> List<InstalledTestDescriptorModel>, | ||
private val createOrIgnoreTestDescriptors: suspend (List<InstalledTestDescriptorModel>) -> Unit, | ||
) { | ||
suspend operator fun invoke() { | ||
createOrIgnoreTestDescriptors(getBootstrapTestDescriptors()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
composeApp/src/commonMain/kotlin/org/ooni/probe/shared/ColorExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.ooni.probe.shared | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
fun String.hexToColor(): Color { | ||
val baseNumber = filter { it != '#' } | ||
val fullNumber = | ||
if (baseNumber.length == 6) { | ||
"FF$baseNumber" | ||
} else { | ||
baseNumber | ||
} | ||
return Color(fullNumber.hexToInt()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
descriptors.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.