From f3b944fc8c3b5bf52dc4ab8ad847db65b4d33146 Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Fri, 5 Jul 2024 16:27:27 +0100 Subject: [PATCH] feat: limit number of revisions displayed --- app/build.gradle | 4 +++- .../ooniprobe/activity/overview/RevisionsView.kt | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 86658f169..e76aebcd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -18,6 +18,7 @@ android { testInstrumentationRunner "org.openobservatory.ooniprobe.TestAndroidJUnitRunner" buildConfigField 'String', 'OONI_API_BASE_URL', '"https://api.ooni.io/"' buildConfigField 'String', 'NOTIFICATION_SERVER', '"https://countly.ooni.io"' + buildConfigField 'String', 'OONI_RUN_DASHBOARD_URL', '"https://run.test.ooni.org"' resValue "string", "APP_ID", 'org.openobservatory.ooniprobe' resValue "string", "APP_NAME", "OONI Probe" buildConfigField 'String', 'SOFTWARE_NAME', 'BASE_SOFTWARE_NAME+IS_DEBUG' @@ -51,7 +52,8 @@ android { stable { dimension 'testing' buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android"' - buildConfigField 'String', 'OONI_API_BASE_URL', '"https://api.dev.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 { dimension 'testing' diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/overview/RevisionsView.kt b/app/src/main/java/org/openobservatory/ooniprobe/activity/overview/RevisionsView.kt index 09a37fcf2..aeb425846 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/overview/RevisionsView.kt +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/overview/RevisionsView.kt @@ -13,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.gson.Gson import org.openobservatory.engine.OONIRunRevisions +import org.openobservatory.ooniprobe.BuildConfig import org.openobservatory.ooniprobe.R import org.openobservatory.ooniprobe.databinding.FragmentRevisionsBinding import org.openobservatory.ooniprobe.databinding.ItemTextBinding @@ -63,14 +64,15 @@ class RevisionsFragment : Fragment() { with(binding.list) { layoutManager = LinearLayoutManager(context) - adapter = revisions?.revisions?.let { + adapter = revisions?.revisions?.take(5)?.let { RevisionsRecyclerViewAdapter(it, object : OnItemClickListener { override fun onItemClick(position: Int) { startActivity( Intent( Intent.ACTION_VIEW, Uri.parse( - "https://run.test.ooni.org/revisions/%s?revision=%s".format( + "%s/revisions/%s?revision=%s".format( + BuildConfig.OONI_RUN_DASHBOARD_URL, runId, it[position] )