Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ooni/probe-android into chore/upd…
Browse files Browse the repository at this point in the history
…ate-to-gradle-version-catalogs
  • Loading branch information
aanorbel committed Oct 12, 2023
2 parents 6aa9fb2 + 8b5f4f2 commit e834f22
Show file tree
Hide file tree
Showing 90 changed files with 1,946 additions and 1,437 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# archive creates and publishes an apk for testing
name: archive
on: [push]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: checkout
uses: actions/checkout@v2
- run: ./gradlew clean assembleDevFullRelease
- name: uploads dev apk
uses: actions/upload-artifact@v3
with:
name: dev-apk
path: app/build/outputs/apk/devFull/release
1 change: 0 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Terms: https://firebase.google.com/terms/

- easypermissions
- LocalhostToolkit
- butterknife
- DBFlow
- LocalhostToolkit
- MarkdownView
24 changes: 7 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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"'
resValue "string", "APP_ID", 'org.openobservatory.ooniprobe'
resValue "string", "APP_NAME", "OONI Probe"
buildConfigField 'String', 'SOFTWARE_NAME', 'BASE_SOFTWARE_NAME+IS_DEBUG'
buildConfigField 'String', 'COUNTLY_KEY', '"146836f41172f9e3287cab6f2cc347de3f5ddf3b"'
Expand Down Expand Up @@ -44,18 +45,6 @@ android {
}
}

// Shared test code between Unit and Instrumented tests
sourceSets {
androidTest {
java.srcDirs += "src/sharedTest/java"
resources.srcDirs += "src/sharedTest/resources"
}
test {
java.srcDirs += "src/sharedTest/java"
resources.srcDirs += "src/sharedTest/resources"
}
}

flavorDimensions 'testing', 'license'
productFlavors {
stable {
Expand All @@ -68,6 +57,7 @@ android {
versionNameSuffix "-beta.1"
versionCode versionCodeDate()
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android-dev"'
resValue "string", "APP_ID", 'org.openobservatory.ooniprobe.dev'
resValue "string", "APP_NAME", "OONI Dev"
buildConfigField 'String', 'COUNTLY_KEY', '"e6c2cfe53e85951d50567467cef3f9fa2eab32c3"'
}
Expand All @@ -77,6 +67,7 @@ android {
versionNameSuffix "-experimental.1"
versionCode versionCodeDate()
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android-experimental"'
resValue "string", "APP_ID", 'org.openobservatory.ooniprobe.experimental'
resValue "string", "APP_NAME", "OONI Exp"
buildConfigField 'String', 'COUNTLY_KEY', '"e6c2cfe53e85951d50567467cef3f9fa2eab32c3"'
}
Expand Down Expand Up @@ -129,9 +120,6 @@ dependencies {
implementation libs.retrofit.logging.interceptor


implementation libs.butterknife.core
annotationProcessor libs.butterknife.compiler

implementation libs.xanscale.localhost.toolkit
implementation libs.lottie
implementation libs.markwon
Expand All @@ -155,7 +143,8 @@ dependencies {

// Testing
// Unit Testing
testImplementation libs.junit4
testImplementation project(':shared-test')
testImplementation libs.junit4
testImplementation libs.androidx.core
testImplementation libs.androidx.runner
testImplementation libs.androidx.rules
Expand All @@ -167,7 +156,8 @@ dependencies {
testAnnotationProcessor libs.google.dagger.compiler

// Instrumentation Testing
androidTestImplementation libs.fastlane.screengrab
androidTestImplementation project(':shared-test')
androidTestImplementation libs.fastlane.screengrab
androidTestImplementation libs.faker
androidTestImplementation libs.androidx.runner
androidTestImplementation libs.androidx.rules
Expand Down
6 changes: 0 additions & 6 deletions app/src/dev/res/values/untranslatable.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/experimental/res/values/untranslatable.xml

This file was deleted.

12 changes: 9 additions & 3 deletions app/src/fdroid/res/xml/preferences_global.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@
app:iconSpaceReserved="false"
android:key="logs"
android:title="@string/Settings_Advanced_RecentLogs">
<intent android:action="@string/preference_intent_log_activity" />
<intent
android:targetPackage="@string/APP_ID"
android:targetClass="@string/preference_intent_log_activity"/>
</PreferenceScreen>
<SwitchPreferenceCompat
android:defaultValue="false"
Expand All @@ -378,7 +380,9 @@
android:icon="@drawable/proxy"
android:key="@string/ooni_backend_proxy"
android:title="@string/Settings_Proxy_Label">
<intent android:action="@string/preference_intent_proxy_activity" />
<intent
android:targetPackage="@string/APP_ID"
android:targetClass="@string/preference_intent_proxy_activity"/>
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/send_email"
Expand All @@ -388,6 +392,8 @@
android:icon="@drawable/about_ooni"
android:key="@string/about_ooni"
android:title="@string/Settings_About_Label">
<intent android:action="@string/preference_intent_about_ooni" />
<intent
android:targetPackage="@string/APP_ID"
android:targetClass="@string/preference_intent_about_ooni" />
</PreferenceScreen>
</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -1,55 +1,42 @@
package org.openobservatory.ooniprobe.activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;

import localhost.toolkit.app.fragment.ConfirmDialogFragment;
import org.openobservatory.ooniprobe.R;
import org.openobservatory.ooniprobe.common.PreferenceManager;
import org.openobservatory.ooniprobe.databinding.ActivityCustomwebsiteBinding;
import org.openobservatory.ooniprobe.model.database.Url;
import org.openobservatory.ooniprobe.test.suite.WebsitesSuite;

import javax.inject.Inject;
import java.io.Serializable;
import java.util.ArrayList;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import localhost.toolkit.app.fragment.ConfirmDialogFragment;

public class CustomWebsiteActivity extends AbstractActivity implements ConfirmDialogFragment.OnConfirmedListener {
@BindView(R.id.urlContainer)
LinearLayout urlContainer;
@BindView(R.id.bottomBar)
Toolbar bottomBar;
private ArrayList<EditText> editTexts;
private ArrayList<ImageButton> deletes;

@Inject
PreferenceManager preferenceManager;
private ActivityCustomwebsiteBinding binding;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivityComponent().inject(this);
setContentView(R.layout.activity_customwebsite);
ButterKnife.bind(this);
binding = ActivityCustomwebsiteBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
editTexts = new ArrayList<>();
deletes = new ArrayList<>();
bottomBar.inflateMenu(R.menu.run);
bottomBar.setOnMenuItemClickListener(item -> {
binding.bottomBar.inflateMenu(R.menu.run);
binding.bottomBar.setOnMenuItemClickListener(item -> {
if (!checkPrefix())
return false;
ArrayList<String> urls = new ArrayList<>(editTexts.size());
Expand All @@ -66,6 +53,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
RunningActivity.runAsForegroundService(CustomWebsiteActivity.this, suite.asArray(), this::finish, preferenceManager);
return true;
});
binding.add.setOnClickListener(v -> add());
add();
}

Expand Down Expand Up @@ -103,12 +91,11 @@ public boolean onSupportNavigateUp() {
return true;
}

@OnClick(R.id.add)
void add() {
ViewGroup urlBox = (ViewGroup) getLayoutInflater().inflate(R.layout.edittext_url, urlContainer, false);
ViewGroup urlBox = (ViewGroup) getLayoutInflater().inflate(R.layout.edittext_url, binding.urlContainer, false);
EditText editText = urlBox.findViewById(R.id.editText);
editTexts.add(editText);
urlContainer.addView(urlBox);
binding.urlContainer.addView(urlBox);
ImageButton delete = urlBox.findViewById(R.id.delete);
deletes.add(delete);
delete.setTag(editText);
Expand All @@ -117,11 +104,11 @@ void add() {
((View) v.getParent()).setVisibility(View.GONE);
editTexts.remove(tag);
deletes.remove(v);
bottomBar.setTitle(getString(R.string.OONIRun_URLs, Integer.toString(editTexts.size())));
binding.bottomBar.setTitle(getString(R.string.OONIRun_URLs, Integer.toString(editTexts.size())));
setVisibilityDelete();
});
setVisibilityDelete();
bottomBar.setTitle(getString(R.string.OONIRun_URLs, Integer.toString(editTexts.size())));
binding.bottomBar.setTitle(getString(R.string.OONIRun_URLs, Integer.toString(editTexts.size())));
}

private void setVisibilityDelete() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,40 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import org.openobservatory.ooniprobe.BuildConfig;
import org.openobservatory.ooniprobe.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import org.openobservatory.ooniprobe.databinding.ActivityInfoBinding;

public class InfoActivity extends AbstractActivity {
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.version) TextView version;

@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
ActivityInfoBinding binding = ActivityInfoBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
version.setText(getString(R.string.version, BuildConfig.SOFTWARE_NAME, BuildConfig.VERSION_NAME));
binding.version.setText(getString(R.string.version, BuildConfig.SOFTWARE_NAME, BuildConfig.VERSION_NAME));

binding.blog.setOnClickListener(v -> onBlogClick());
binding.reports.setOnClickListener(v -> onReportsClick());
binding.learnMore.setOnClickListener(v -> onLearnMoreClick());
binding.dataPolicy.setOnClickListener(v -> onDataPolicyClick());
}

@OnClick(R.id.blog) void onBlogClick() {
void onBlogClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/blog/")));
}

@OnClick(R.id.reports) void onReportsClick() {
void onReportsClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/reports/")));
}

@OnClick(R.id.learnMore) void onLearnMoreClick() {
void onLearnMoreClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/")));
}

@OnClick(R.id.dataPolicy) void onDataPolicyClick() {
void onDataPolicyClick() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://ooni.org/about/data-policy/")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;

import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.snackbar.Snackbar;

import org.openobservatory.ooniprobe.R;
Expand All @@ -38,8 +37,6 @@

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import localhost.toolkit.app.fragment.ConfirmDialogFragment;

public class MainActivity extends AbstractActivity implements ConfirmDialogFragment.OnConfirmedListener {
Expand Down Expand Up @@ -71,7 +68,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
finish();
}
else {
ButterKnife.bind(this);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
binding.bottomNavigation.setOnItemSelectedListener(item -> {
Expand Down
Loading

0 comments on commit e834f22

Please sign in to comment.