Skip to content

Commit

Permalink
[NMS] Run v2 Support (#728)
Browse files Browse the repository at this point in the history
## Proposed Changes

  - Update dashboard view for `nms`.
- Restructure `RunTestsExpandableListViewAdapter` to support different
configuration for `ooni-probe` and `nms`
- Introduce `DefaultDescriptors` to install default OONI Run descriptors
for `nms`.
  - Customize various activities for `nms`.

---------

Co-authored-by: Simone Basso <bassosimone@gmail.com>
  • Loading branch information
aanorbel and bassosimone authored Jul 17, 2024
1 parent fdc7895 commit 8fcf5f6
Show file tree
Hide file tree
Showing 22 changed files with 1,156 additions and 587 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ android {
stable {
dimension 'testing'
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android"'
buildConfigField 'String', 'OONI_API_BASE_URL', '"https://api.prod.ooni.io/"'
buildConfigField 'String', 'OONI_API_BASE_URL', '"https://api.prod.ooni.io"'
buildConfigField 'String', 'OONI_RUN_DASHBOARD_URL', '"https://run-v2.ooni.org"'
}
dev {
Expand Down
312 changes: 312 additions & 0 deletions app/src/dw/assets/descriptors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
[
{
"name": "Trusted International Media",
"short_description": "The most reliable international media outlets.",
"description": "In this list you will find the largest, most reliable international media outlets in the world.",
"author": "internet-freedom@dw.com",
"nettests": [
{
"test_name": "web_connectivity",
"inputs": [
"https://www.dw.com",
"https://www.francemediasmonde.com/",
"https://www.mc-doualiya.com/",
"https://www.dw.com/",
"https://www.bbc.com/",
"http://www.lemonde.fr/",
"https://www.rferl.org/",
"http://www.rfi.fr/",
"http://www.voanews.com/",
"https://ici.radio-canada.ca/rci/en",
"https://www.rfa.org/english/",
"https://www.france24.com/en/",
"https://www3.nhk.or.jp/nhkworld/",
"https://www.abc.net.au/news",
"https://www.swissinfo.ch/eng/",
"https://www.srgssr.ch/en/home/"
],
"options": {},
"backend_options": {},
"is_background_run_enabled_default": false,
"is_manual_run_enabled_default": false
}
],
"name_intl": {
"de": "Vertrauenswürdige Internationale Medien",
"en": "Trusted international media",
"ru": "Доверенные международные СМИ"
},
"short_description_intl": {},
"description_intl": {},
"icon": "FaShield",
"color": "#68bc00",
"expiration_date": "2027-07-24T00:00:00.000000Z",
"oonirun_link_id": "10004",
"date_created": "2024-06-06T14:35:13.000000Z",
"date_updated": "2024-06-06T14:56:44.000000Z",
"revision": "2",
"is_mine": false,
"is_expired": false
},
{
"name": "Selected (inter)national media",
"short_description": "Selected national and international media outlets.",
"description": "Selected national and international media outlets. \nWarning: This could also include biased and/or propagandistic media.",
"author": "internet-freedom@dw.com",
"nettests": [
{
"test_name": "web_connectivity",
"inputs": [
"https://dartcenter.org/",
"https://ourworldindata.org/",
"https://www.propublica.org/",
"http://www.1tv.ru/",
"http://www.vesti.ru/",
"https://sputnikglobe.com/",
"https://rtr-planeta.com/",
"https://www.ntv.ru/",
"https://www.rtarabic.com/",
"https://vgtrk.ru/",
"https://www.currenttime.tv/",
"https://www.dailywire.com/",
"https://timcast.com/",
"https://www.projectveritas.com/",
"https://www.francemediasmonde.com/",
"https://www.france24.com/ar/",
"https://www.mc-doualiya.com/",
"https://www.washingtonpost.com/",
"https://www.spiegel.de/",
"https://www.icij.org/",
"https://foreignpolicy.com/",
"https://www.reuters.com/",
"https://sputniknews.com/",
"https://www.sbs.com.au/language/coronavirus?cid=infocus",
"http://www.ftchinese.com/",
"http://www.sputniknews.cn/",
"http://www.dailymail.co.uk/",
"https://www.theatlantic.com/",
"https://www.nbcnews.com/",
"https://www.aljazeera.com/",
"https://www.urduvoa.com/",
"https://www.dw.com/",
"https://www.nbc.com/",
"http://abc.go.com/",
"https://theintercept.com/",
"https://www.bbc.com/",
"https://www.bbc.co.uk/",
"https://www.chinadaily.com.cn/",
"https://news.google.com/",
"https://nypost.com/",
"https://www.wsj.com/",
"https://timesofindia.indiatimes.com/",
"https://wikileaks.org/",
"https://www.afp.com/",
"https://www.alarabiya.net/",
"https://www.aljazeera.net/",
"https://www.cbc.ca/",
"https://www.cbsnews.com/",
"https://www.chinatimes.com/",
"https://edition.cnn.com/",
"https://www.foxnews.com/",
"https://www.ft.com/",
"http://www.granma.cu/",
"https://www.haaretz.com/",
"http://www.indiatimes.com/",
"http://www.irna.ir/",
"http://www.kcna.kp/",
"http://www.lemonde.fr/",
"http://www.mainichi.co.jp/",
"http://www.mizzima.com/",
"https://www.nytimes.com/",
"http://www.people.com.cn/",
"http://www.pravda.ru/",
"https://www.rambler.ru/",
"https://www.reddit.com/",
"http://www.repubblica.com/",
"https://www.rferl.org/",
"http://www.rfi.fr/",
"https://www.rt.com/",
"https://www.telegraph.co.uk/",
"http://www.theepochtimes.com/",
"https://www.theguardian.com/",
"http://www.voanews.com/",
"http://www.washingtontimes.com/",
"http://www.xinhuanet.com/",
"http://www.zeit.de/"
],
"options": {},
"backend_options": {},
"is_background_run_enabled_default": false,
"is_manual_run_enabled_default": false
}
],
"name_intl": {},
"short_description_intl": {},
"description_intl": {},
"icon": "FaBookOpenReader",
"color": "#000000",
"expiration_date": "2027-07-24T00:00:00.000000Z",
"oonirun_link_id": "10005",
"date_created": "2024-06-06T14:37:53.000000Z",
"date_updated": "2024-06-06T14:37:53.000000Z",
"revision": "2",
"is_mine": false,
"is_expired": false
},
{
"name": "Global media ",
"short_description": "A wide range of global media.",
"description": "This is the largest collection of media worldwide.\n\nAttention: This list will most likely contain propagandistic and influenced media outlets.",
"author": "internet-freedom@dw.com",
"nettests": [
{
"test_name": "web_connectivity",
"inputs": [
"https://dartcenter.org/",
"https://ourworldindata.org/",
"https://www.propublica.org/",
"https://www.vesti.ru/",
"http://ren.tv/",
"http://smotrim.ru/",
"http://www.1tv.ru/",
"http://www.tvc.ru/",
"http://www.vesti.ru/",
"https://sputnikglobe.com/",
"https://rtr-planeta.com/",
"https://www.ntv.ru/",
"https://www.rtarabic.com/",
"https://vgtrk.ru/",
"https://www.currenttime.tv/",
"http://www.freeexpression.org/",
"https://www.dailywire.com/",
"https://timcast.com/",
"https://wearechange.org/",
"https://reclaimthenet.org/",
"https://www.muckrock.com/",
"https://www.projectveritas.com/",
"https://substack.com/",
"https://www.infowars.com/",
"https://banthis.tv/",
"http://ria.ru/",
"https://www.francemediasmonde.com/",
"https://www.france24.com/ar/",
"https://www.mc-doualiya.com/",
"https://www.usatoday.com/",
"https://www.washingtonpost.com/",
"https://www.spiegel.de/",
"https://www.icij.org/",
"http://www.qhtyzx.com/",
"http://www.qhnews.com/",
"https://liveuamap.com/",
"https://foreignpolicy.com/",
"https://www.reuters.com/",
"https://sputniknews.com/",
"https://www.sbs.com.au/language/coronavirus?cid=infocus",
"http://www.ftchinese.com/",
"http://www.sputniknews.cn/",
"https://www.dailysabah.com/",
"http://www.dailymail.co.uk/",
"https://www.economist.com/",
"https://www.theatlantic.com/",
"https://www.nbcnews.com/",
"https://slate.com/",
"https://www.aljazeera.com/",
"https://globalpressjournal.com/",
"https://www.urduvoa.com/",
"https://www.dw.com/",
"https://www.vice.com/",
"https://tyt.com/",
"https://www.nbc.com/",
"http://abc.go.com/",
"https://theintercept.com/",
"https://www.bbc.com/",
"https://www.bbc.co.uk/",
"https://asiatimes.com/",
"https://boingboing.net/",
"https://www.chinadaily.com.cn/",
"https://creativecommons.org/",
"https://indymedia.org/",
"https://ipi.media/",
"https://jezebel.com/",
"http://www.kabobfest.com/",
"https://news.google.com/",
"https://nypost.com/",
"https://www.wsj.com/",
"http://russia.tv/",
"https://slashdot.org/",
"https://timesofindia.indiatimes.com/",
"https://wikileaks.org/",
"https://www.advocate.com/",
"https://www.afp.com/",
"https://www.ahram.org.eg/",
"https://www.alarabiya.net/",
"https://www.aljazeera.net/",
"https://www.almanar.com.lb/",
"https://www.arabnews.com/",
"https://www.benedelman.org/",
"https://www.cbc.ca/",
"https://www.cbsnews.com/",
"https://www.chinatimes.com/",
"https://edition.cnn.com/",
"https://www.csmonitor.com/",
"https://www.democracynow.org/",
"https://www.dopplr.com/",
"http://www.drudgereport.com/",
"https://www.eluniversal.com/",
"https://www.foxnews.com/",
"https://www.ft.com/",
"https://www.gearthblog.com/",
"http://www.granma.cu/",
"https://www.haaretz.com/",
"https://www.huffpost.com/",
"http://www.indiatimes.com/",
"http://www.irna.ir/",
"http://www.kcna.kp/",
"http://www.lanacion.com.ar/",
"http://www.latimes.com/",
"http://www.lemonde.fr/",
"http://www.mainichi.co.jp/",
"https://www.mideastyouth.com/",
"http://www.mizzima.com/",
"https://www.nytimes.com/",
"http://www.ohmynews.com/",
"http://www.osce.org/",
"http://www.people.com.cn/",
"http://www.pravda.ru/",
"https://www.rambler.ru/",
"https://www.reddit.com/",
"http://www.repubblica.com/",
"https://www.rferl.org/",
"http://www.rfi.fr/",
"https://www.rt.com/",
"https://www.telegraph.co.uk/",
"http://www.theepochtimes.com/",
"https://www.theguardian.com/",
"http://www.theregister.co.uk/",
"http://www.voanews.com/",
"http://www.washingtontimes.com/",
"http://www.wnd.com/",
"http://www.xinhuanet.com/",
"http://www.zeit.de/",
"http://xxx.lanl.gov/"
],
"options": {},
"backend_options": {},
"is_background_run_enabled_default": false,
"is_manual_run_enabled_default": false
}
],
"name_intl": {},
"short_description_intl": {},
"description_intl": {},
"icon": "FaEarthAmericas",
"color": "#000000",
"expiration_date": "2027-07-24T00:00:00.000000Z",
"oonirun_link_id": "10006",
"date_created": "2024-06-06T14:39:02.000000Z",
"date_updated": "2024-06-06T14:39:02.000000Z",
"revision": "2",
"is_mine": false,
"is_expired": false
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.openobservatory.ooniprobe.activity.runtests.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import org.openobservatory.ooniprobe.R
import org.openobservatory.ooniprobe.activity.runtests.RunTestsViewModel
import org.openobservatory.ooniprobe.activity.runtests.models.ChildItem
import org.openobservatory.ooniprobe.activity.runtests.models.GroupItem
import org.openobservatory.ooniprobe.test.test.AbstractTest


class RunTestsExpandableListViewAdapter(
private val groupedListData: List<Any>,
private val viewModel: RunTestsViewModel
) : AbstractRunTestsExpandableListViewAdapter(groupedListData, viewModel) {

override fun getChildrenCount(groupPosition: Int): Int {
val group = groupedListData[groupPosition]
return if (group is GroupItem && group.nettests.isNotEmpty()) {
group.nettests[0].inputs?.size ?: 0
} else {
0
}
}


override fun getChild(groupPosition: Int, childPosition: Int): ChildItem {

return when (val group = groupedListData[groupPosition]) {
is GroupItem -> {
ChildItem(
name = group.nettests[0].inputs?.get(childPosition)
?: "",
selected = false,
inputs = null
)
}

else -> ChildItem(name = "", selected = false, inputs = null)
}
}

override fun getChildView(
groupPosition: Int,
childPosition: Int,
isLastChild: Boolean,
convertView: View?,
parent: ViewGroup
): View? {
var convertView =
convertView
?: LayoutInflater.from(parent.context)
.inflate(R.layout.run_tests_child_list_item, parent, false)
val childItem = getChild(groupPosition, childPosition)
convertView.findViewById<TextView>(R.id.child_name)?.apply {
text = childItem.name
}
convertView.findViewById<ImageView>(R.id.child_select).apply {
visibility = View.GONE
}
return convertView
}
}
Loading

0 comments on commit 8fcf5f6

Please sign in to comment.