Skip to content

Commit

Permalink
Merge branches 'xoonirun' and 'master' of github.com:ooni/probe-andro…
Browse files Browse the repository at this point in the history
…id into xoonirun
  • Loading branch information
aanorbel committed Nov 28, 2023
2 parents 21e5ebb + 3caea0f commit fa156e8
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
Expand Down
20 changes: 12 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'
}
apply from: 'jacoco.gradle'
apply plugin: 'org.jetbrains.kotlin.android'
Expand Down Expand Up @@ -86,8 +87,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding = true
Expand Down Expand Up @@ -120,7 +124,7 @@ dependencies {
implementation 'androidx.work:work-runtime:2.8.1'

// Third-party
annotationProcessor libs.dbflow.processor
kapt libs.dbflow.processor
implementation libs.dbflow.core
implementation libs.dbflow.lib

Expand All @@ -131,7 +135,7 @@ dependencies {

implementation libs.xanscale.localhost.toolkit
implementation libs.lottie
implementation libs.markwon
implementation libs.markwon.core
implementation libs.commons.io
//arcview to fragment_dashboard
implementation libs.shapeofview
Expand All @@ -145,7 +149,7 @@ dependencies {

// Dependency Injection
implementation libs.google.dagger
annotationProcessor libs.google.dagger.compiler
kapt libs.google.dagger.compiler

// Logger
implementation project(':applogger')
Expand All @@ -162,7 +166,7 @@ dependencies {
testImplementation libs.robolectric
testImplementation libs.faker
testImplementation libs.ooni.oonimkall
testAnnotationProcessor libs.google.dagger.compiler
kaptTest libs.google.dagger.compiler

// Instrumentation Testing
androidTestImplementation project(':shared-test')
Expand All @@ -175,7 +179,7 @@ dependencies {
androidTestImplementation libs.androidx.espresso.contrib
androidTestImplementation libs.androidx.espresso.core
androidTestImplementation libs.barista
androidTestAnnotationProcessor libs.google.dagger.compiler
kaptAndroidTest libs.google.dagger.compiler
}

static def versionCodeDate() {
Expand Down
20 changes: 13 additions & 7 deletions app/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ task jacocoAndroidTestReport(type: JacocoReport) {
executionData.from += fileTree(dir: codeCoverageDataLocation, includes: ['**/*.ec'])
}

reports {
html.enabled true
html.destination file("${buildDir}/reports/coverage")
xml.enabled true
xml.destination file("${buildDir}/reports/coverage.xml")
csv.enabled false
}
reports {
html {
enabled true
destination file("${buildDir}/reports/coverage")
}
xml {
enabled true
destination file("${buildDir}/reports/coverage.xml")
}
csv {
enabled false
}
}

doLast {
println "Wrote HTML coverage report to ${reports.html.destination}/index.html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
Expand All @@ -14,34 +13,58 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment;

import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import localhost.toolkit.app.fragment.ConfirmDialogFragment;

import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.common.PreferenceManager;
import org.openobservatory.ooniprobe.common.ResubmitTask;
import org.openobservatory.ooniprobe.databinding.ActivityMeasurementDetailBinding;
import org.openobservatory.ooniprobe.domain.GetTestSuite;
import org.openobservatory.ooniprobe.domain.MeasurementsManager;
import org.openobservatory.ooniprobe.domain.callback.DomainCallback;
import org.openobservatory.ooniprobe.fragment.measurement.*;
import org.openobservatory.ooniprobe.fragment.measurement.DashFragment;
import org.openobservatory.ooniprobe.fragment.measurement.FacebookMessengerFragment;
import org.openobservatory.ooniprobe.fragment.measurement.FailedFragment;
import org.openobservatory.ooniprobe.fragment.measurement.HeaderNdtFragment;
import org.openobservatory.ooniprobe.fragment.measurement.HeaderOutcomeFragment;
import org.openobservatory.ooniprobe.fragment.measurement.HttpHeaderFieldManipulationFragment;
import org.openobservatory.ooniprobe.fragment.measurement.HttpInvalidRequestLineFragment;
import org.openobservatory.ooniprobe.fragment.measurement.NdtFragment;
import org.openobservatory.ooniprobe.fragment.measurement.PsiphonFragment;
import org.openobservatory.ooniprobe.fragment.measurement.RiseupVPNFragment;
import org.openobservatory.ooniprobe.fragment.measurement.SignalFragment;
import org.openobservatory.ooniprobe.fragment.measurement.TelegramFragment;
import org.openobservatory.ooniprobe.fragment.measurement.TorFragment;
import org.openobservatory.ooniprobe.fragment.measurement.WebConnectivityFragment;
import org.openobservatory.ooniprobe.fragment.measurement.WhatsappFragment;
import org.openobservatory.ooniprobe.fragment.resultHeader.ResultHeaderDetailFragment;
import org.openobservatory.ooniprobe.model.database.Measurement;
import org.openobservatory.ooniprobe.model.database.Network;
import org.openobservatory.ooniprobe.test.suite.OONIRunSuite;
import org.openobservatory.ooniprobe.test.suite.PerformanceSuite;
import org.openobservatory.ooniprobe.test.test.*;
import ru.noties.markwon.Markwon;
import org.openobservatory.ooniprobe.test.test.Dash;
import org.openobservatory.ooniprobe.test.test.FacebookMessenger;
import org.openobservatory.ooniprobe.test.test.HttpHeaderFieldManipulation;
import org.openobservatory.ooniprobe.test.test.HttpInvalidRequestLine;
import org.openobservatory.ooniprobe.test.test.Ndt;
import org.openobservatory.ooniprobe.test.test.Psiphon;
import org.openobservatory.ooniprobe.test.test.RiseupVPN;
import org.openobservatory.ooniprobe.test.test.Signal;
import org.openobservatory.ooniprobe.test.test.Telegram;
import org.openobservatory.ooniprobe.test.test.Tor;
import org.openobservatory.ooniprobe.test.test.WebConnectivity;
import org.openobservatory.ooniprobe.test.test.Whatsapp;

import javax.inject.Inject;
import java.io.Serializable;
import java.util.Collections;
import java.util.Objects;

import javax.inject.Inject;

import io.noties.markwon.Markwon;
import localhost.toolkit.app.fragment.ConfirmDialogFragment;
import ru.noties.markwon.Markwon;

public class MeasurementDetailActivity extends AbstractActivity implements ConfirmDialogFragment.OnConfirmedListener {
private static final String ID = "id";
Expand Down Expand Up @@ -241,7 +264,9 @@ public void onError(String msg) {
binding.log.setVisibility(View.GONE);
if (!measurementsManager.hasReportId(measurement))
binding.explorer.setVisibility(View.GONE);
Markwon.setMarkdown(binding.methodology, getString(R.string.TestResults_Details_Methodology_Paragraph, getString(measurement.getTest().getUrlResId())));
Markwon.builder(this)
.build()
.setMarkdown(binding.methodology, getString(R.string.TestResults_Details_Methodology_Paragraph, getString(measurement.getTest().getUrlResId())));
load();
binding.log.setOnClickListener(v -> logClick());
binding.data.setOnClickListener(v -> dataClick());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -35,7 +34,7 @@

import javax.inject.Inject;

import ru.noties.markwon.Markwon;
import io.noties.markwon.Markwon;

public class OverviewActivity extends AbstractActivity {
private static final String TEST = "test";
Expand Down Expand Up @@ -157,12 +156,14 @@ private void updateViewFromDescriptor(TestDescriptor descriptor) {
@BindingAdapter(value = {"richText", "testSuiteName"})
public static void setRichText(TextView view, String richText,String testSuiteName) {
try {
Markwon markwon = Markwon.builder(view.getContext()).build();

if (Objects.equals(testSuiteName,ExperimentalSuite.NAME)) {
Markwon.setMarkdown(view, richText);
markwon.setMarkdown(view, richText);
if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL)
view.setTextDirection(View.TEXT_DIRECTION_RTL);
} else {
Markwon.setMarkdown(view, richText);
markwon.setMarkdown(view, richText);
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.openobservatory.ooniprobe.common.ProxyProtocol;
import org.openobservatory.ooniprobe.common.ProxySettings;
import org.openobservatory.ooniprobe.databinding.ActivityProxyBinding;
import ru.noties.markwon.Markwon;
import io.noties.markwon.Markwon;

import javax.inject.Inject;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -119,7 +119,9 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(binding.getRoot());

// We fill the footer that helps users to understand this settings screen.
Markwon.setMarkdown(binding.proxyFooter, getString(R.string.Settings_Proxy_Footer));
Markwon.builder(this)
.build()
.setMarkdown(binding.proxyFooter, getString(R.string.Settings_Proxy_Footer));

// We read settings and configure the initial view.
loadSettingsAndConfigureInitialView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.databinding.FragmentMeasurementPsiphonBinding;
import org.openobservatory.ooniprobe.model.database.Measurement;
import ru.noties.markwon.Markwon;

import io.noties.markwon.Markwon;

public class PsiphonFragment extends Fragment {
private static final String MEASUREMENT = "measurement";
Expand All @@ -28,7 +29,9 @@ public static PsiphonFragment newInstance(Measurement measurement) {
Measurement measurement = (Measurement) getArguments().getSerializable(MEASUREMENT);
assert measurement != null;
FragmentMeasurementPsiphonBinding binding = FragmentMeasurementPsiphonBinding.inflate(inflater,container,false);
Markwon.setMarkdown(binding.desc,
Markwon.builder(getContext())
.build()
.setMarkdown(binding.desc,
measurement.is_anomaly ?
getString(R.string.TestResults_Details_Circumvention_Psiphon_Blocked_Content_Paragraph) :
getString(R.string.TestResults_Details_Circumvention_Psiphon_Reachable_Content_Paragraph)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.databinding.FragmentMeasurementRiseupvpnBinding;
import org.openobservatory.ooniprobe.model.database.Measurement;
import ru.noties.markwon.Markwon;

import io.noties.markwon.Markwon;

public class RiseupVPNFragment extends Fragment {
private static final String MEASUREMENT = "measurement";
Expand All @@ -28,7 +29,9 @@ public static RiseupVPNFragment newInstance(Measurement measurement) {
Measurement measurement = (Measurement) getArguments().getSerializable(MEASUREMENT);
assert measurement != null;
FragmentMeasurementRiseupvpnBinding binding = FragmentMeasurementRiseupvpnBinding.inflate(inflater,container,false);
Markwon.setMarkdown(binding.desc,
Markwon.builder(getContext())
.build()
.setMarkdown(binding.desc,
measurement.is_anomaly ?
getString(R.string.TestResults_Details_Circumvention_RiseupVPN_Blocked_Content_Paragraph) :
getString(R.string.TestResults_Details_Circumvention_RiseupVPN_Reachable_Content_Paragraph)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.databinding.FragmentMeasurementTorBinding;
import org.openobservatory.ooniprobe.model.database.Measurement;
import ru.noties.markwon.Markwon;

import io.noties.markwon.Markwon;

public class TorFragment extends Fragment {
private static final String MEASUREMENT = "measurement";
Expand All @@ -30,7 +31,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
Measurement measurement = (Measurement) getArguments().getSerializable(MEASUREMENT);
assert measurement != null;
FragmentMeasurementTorBinding binding = FragmentMeasurementTorBinding.inflate(inflater,container,false);
Markwon.setMarkdown(binding.desc,
Markwon.builder(getContext())
.build()
.setMarkdown(binding.desc,
measurement.is_anomaly ?
getString(R.string.TestResults_Details_Circumvention_Tor_Blocked_Content_Paragraph) :
getString(R.string.TestResults_Details_Circumvention_Tor_Reachable_Content_Paragraph)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.databinding.FragmentMeasurementWebconnectivityBinding;
import org.openobservatory.ooniprobe.model.database.Measurement;
import ru.noties.markwon.Markwon;

import io.noties.markwon.Markwon;

public class WebConnectivityFragment extends Fragment {
private static final String MEASUREMENT = "measurement";
Expand All @@ -30,10 +31,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
Measurement measurement = (Measurement) getArguments().getSerializable(MEASUREMENT);
assert measurement != null;
FragmentMeasurementWebconnectivityBinding binding = FragmentMeasurementWebconnectivityBinding.inflate(inflater,container,false);
Markwon markwon = Markwon.builder(getContext()).build();
if (measurement.is_anomaly)
Markwon.setMarkdown(binding.desc, getString(R.string.TestResults_Details_Websites_LikelyBlocked_Content_Paragraph, measurement.url.url, getString(measurement.getTestKeys().getWebsiteBlocking())));
markwon.setMarkdown(binding.desc, getString(R.string.TestResults_Details_Websites_LikelyBlocked_Content_Paragraph, measurement.url.url, getString(measurement.getTestKeys().getWebsiteBlocking())));
else
Markwon.setMarkdown(binding.desc, getString(R.string.TestResults_Details_Websites_Reachable_Content_Paragraph, measurement.url.url));
markwon.setMarkdown(binding.desc, getString(R.string.TestResults_Details_Websites_Reachable_Content_Paragraph, measurement.url.url));
return binding.getRoot();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.openobservatory.ooniprobe.common.ThirdPartyServices;
import org.openobservatory.ooniprobe.common.service.ServiceUtil;
import org.openobservatory.ooniprobe.databinding.FragmentOnboarding3Binding;
import ru.noties.markwon.Markwon;
import io.noties.markwon.Markwon;

import javax.inject.Inject;

Expand All @@ -31,7 +31,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
binding.bullet1.setText(getString(R.string.bullet, getString(R.string.Onboarding_DefaultSettings_Bullet_1)));
binding.bullet2.setText(getString(R.string.bullet, getString(R.string.Onboarding_DefaultSettings_Bullet_2)));
binding.bullet3.setText(getString(R.string.bullet, getString(R.string.Onboarding_DefaultSettings_Bullet_3)));
Markwon.setMarkdown(binding.paragraph, getString(R.string.Onboarding_DefaultSettings_Paragraph));
Markwon.builder(getContext())
.build()
.setMarkdown(binding.paragraph, getString(R.string.Onboarding_DefaultSettings_Paragraph));

binding.master.setOnClickListener(v -> masterClick());
binding.slave.setOnClickListener(v -> slaveClick());
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
Expand Down
Loading

0 comments on commit fa156e8

Please sign in to comment.