Skip to content

Commit

Permalink
Feat: Add News Media Scan flavor (#549)
Browse files Browse the repository at this point in the history
## Proposed Changes

- Update application based on designs

| Light      | Dark |
| ----------- | ----------- |
|
![01_onboarding_2](https://github.com/ooni/probe-android/assets/17911892/77b28ed1-a0fc-4b50-bf53-35edbc5c7264)
| . |
|
![01_onboarding_2](https://github.com/ooni/probe-android/assets/17911892/77b28ed1-a0fc-4b50-bf53-35edbc5c7264)
| . |
|
![02_onboarding_2_q1](https://github.com/ooni/probe-android/assets/17911892/3694018b-2abd-4f22-8c6b-d353cf08251c)
| . |
|
![02_onboarding_2_q2](https://github.com/ooni/probe-android/assets/17911892/f1c1773c-a598-43b3-be36-c62bf0e70a96)
| . |
|
![03_automated_testing](https://github.com/ooni/probe-android/assets/17911892/4988e76d-0269-4faf-a9b3-7d96eb2ebfe1)
| . |
|
![04_crash_report](https://github.com/ooni/probe-android/assets/17911892/06e21c44-d456-4317-837b-c2c0adf03289)
| . |
|
![05_default_settings](https://github.com/ooni/probe-android/assets/17911892/81ca2ddf-d346-467e-a3a3-b745c48bb393)
| . |
|
![06_dashboard](https://github.com/ooni/probe-android/assets/17911892/7872db1e-c63f-4566-b86e-4d6a202a811e)
|
![06_dashboard](https://github.com/ooni/probe-android/assets/17911892/aa9dcb44-72f9-48ea-b1f7-f5f39a0dbf1e)
|
|
![07_test_results](https://github.com/ooni/probe-android/assets/17911892/a1fa4b53-d626-4eab-a461-1c30f953a2d9)
|
![07_test_results](https://github.com/ooni/probe-android/assets/17911892/af57360b-76ef-4525-8744-88e5f001a24d)
|
|
![08_test_results_dash](https://github.com/ooni/probe-android/assets/17911892/5326fec5-b56a-41a6-80eb-0f4e1592dab8)
|
![08_test_results_dash](https://github.com/ooni/probe-android/assets/17911892/5f0e3980-c570-43e2-8812-1d584bbc48d8)
|
|
![08_test_results_webconnectivity](https://github.com/ooni/probe-android/assets/17911892/24080695-5adb-477e-9cae-3994ab849f7e)
|
![08_test_results_webconnectivity](https://github.com/ooni/probe-android/assets/17911892/2dabcb40-fc66-4065-9fde-bed6bc081a01)
|
|
![09_settings](https://github.com/ooni/probe-android/assets/17911892/417d1cd5-0e55-4502-a74b-0b1edc55bfb9)
|
![09_settings](https://github.com/ooni/probe-android/assets/17911892/5f5d3bc5-d696-4af0-b01f-d55b1ba81176)
|
|
![10_info](https://github.com/ooni/probe-android/assets/17911892/9cfd248a-17b3-4f90-ad94-5ac663d75263)
|
![10_info](https://github.com/ooni/probe-android/assets/17911892/9e26f817-29a4-4f18-b9f5-ef39a505452b)
|



# Tasks
- [x] Test card coloring.
- [x] Onboarding colours.
- [x] Grainy images.
- [x] About page.

---------

Co-authored-by: Simone Basso <bassosimone@gmail.com>
  • Loading branch information
aanorbel and bassosimone authored Jul 15, 2024
1 parent 42b0bc7 commit 3106d03
Show file tree
Hide file tree
Showing 114 changed files with 5,637 additions and 142 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ jobs:
strategy:
matrix:
version:
- "StableFullRelease"
- "StableFdroidRelease"
- "OoniStableFullRelease"
- "OoniStableFdroidRelease"
- "DwStableFullRelease"
- "DwStableFdroidRelease"

steps:
- name: Set up JDK 17
Expand Down Expand Up @@ -47,14 +49,14 @@ jobs:
uses: actions/checkout@v4

- name: Run unit tests
run: ./gradlew testStableFullRelease
run: ./gradlew testOoniStableFullRelease

- name: Uploads test reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-report
path: app/build/test-results/testStableFullDebugUnitTest
path: app/build/test-results/testOoniStableFullReleaseUnitTest

instrumented-test:
name: Run instrumented tests
Expand Down Expand Up @@ -85,14 +87,14 @@ jobs:
profile: pixel_3_xl
ram-size: 4096M
disable-animations: true
script: ./gradlew connectedStableFullDebugAndroidTest
script: ./gradlew connectedOoniStableFullDebugAndroidTest

- name: uploads test reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: emulator-test-reports
path: app/build/reports/androidTests/connected/debug/flavors/stableFull/
path: app/build/reports/androidTests/connected/debug/flavors/ooniStableFull/

assemble-archive:
name: Archive APKs
Expand All @@ -101,10 +103,13 @@ jobs:
strategy:
matrix:
version:
- "StableFullDebug"
- "StableFdroidDebug"
- "DevFullDebug"
- "DevFullDebugAndroidTest"
- "OoniStableFullDebug"
- "OoniStableFdroidDebug"
- "OoniDevFullDebug"
- "OoniDevFullDebugAndroidTest"
- "DwStableFullDebug"
- "DwStableFdroidDebug"
- "DwDevFullDebug"
needs: [ build ]

steps:
Expand Down Expand Up @@ -148,10 +153,13 @@ jobs:
with:
name: ${{ matrix.version }}Apk
path: |
app/build/outputs/apk/devFull/debug/app-dev-full-debug.apk
app/build/outputs/apk/androidTest/devFull/debug/app-dev-full-debug-androidTest.apk
app/build/outputs/apk/stableFull/debug/app-stable-full-debug.apk
app/build/outputs/apk/stableFdroid/debug/app-stable-fdroid-debug.apk
app/build/outputs/apk/ooniStableFull/debug/app-ooni-stable-full-debug.apk
app/build/outputs/apk/ooniStableFdroid/debug/app-ooni-stable-fdroid-debug.apk
app/build/outputs/apk/ooniDevFull/debug/app-ooni-dev-full-debug.apk
app/build/outputs/apk/androidTest/ooniDevFull/debug/app-ooni-dev-full-debug-androidTest.apk
app/build/outputs/apk/dwStableFull/debug/app-dw-stable-full-debug.apk
app/build/outputs/apk/dwStableFdroid/debug/app-dw-stable-fdroid-debug.apk
app/build/outputs/apk/dwDevFull/debug/app-dw-dev-full-debug.apk
distribute:
name: Upload artifact to Firebase App Distribution
Expand All @@ -165,7 +173,7 @@ jobs:
- name: Download app APK
uses: actions/download-artifact@v4
with:
name: DevFullDebugApk
name: OoniDevFullDebugApk

- name: Upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.0
Expand All @@ -174,7 +182,7 @@ jobs:
appId: ${{secrets.FIREBASE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: testers
file: devFull/debug/app-dev-full-debug.apk
file: ooniDevFull/debug/app-ooni-dev-full-debug.apk
- name: Write Summary
run: |
echo "View this release in the Firebase console: ${{ steps.uploadArtifact.outputs.FIREBASE_CONSOLE_URI }}" >> $GITHUB_STEP_SUMMARY
69 changes: 34 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,85 +61,84 @@ implement the following flavours:

- `full` and `fdroid` (dimension: `license`).

- `ooni` and `dw` (dimension: `brand`).

The `testing` dimension controls whether we're building a release
or a more unstable version. We build releases using the `stable`
flavour. The `dev` flavour builds the version of the app that should
be released on the store as the beta channel. The `experimental`
flavour, instead, allows a developer to build a one-off version of
the app that uses a custom build of the `oonimkall` library.

For `stable` and `dev`, we fetch `oonimkall` from the
[Maven central](https://search.maven.org/artifact/org.ooni/oonimkall)
repository. The `experimental` flavour, instead, requires you to
put the `oonimkall.aar` you built inside `engine-experimental`.

The `license` dimension controls which proprietary libraries to include
into the build. The `full` flavour includes all such dependencies,
while the `fdroid` flavour does not include any of them.

The variant names are therefore:
The `brand` dimension controls the branding of the application. The `ooni` flavour is the default branding, while the `dw` flavour is for the "News Media Scan" branding.

- `experimentalFullDebug`
- `experimentalFullRelease`
- `devFullDebug`
- `devFullRelease`
- `stableFullDebug`
- `stableFullRelease`
The variant names are therefore:

We additionally have `stableFdroidDebug` and `stableFdroidRelease`.
- `ooniExperimentalFullDebug`
- `ooniExperimentalFullRelease`
- `ooniDevFullDebug`
- `ooniDevFullRelease`
- `ooniStableFullDebug`
- `ooniStableFullRelease`
- `dwExperimentalFullDebug`
- `dwExperimentalFullRelease`
- `dwDevFullDebug`
- `dwDevFullRelease`
- `dwStableFullDebug`
- `dwStableFullRelease`

We additionally have `ooniStableFdroidDebug`, `ooniStableFdroidRelease`, `dwStableFdroidDebug` and `dwStableFdroidRelease`.

All of this is controlled by [app/build.gradle](app/build.gradle).

## Gradle modules

- [app](app) contains the mobile app;
- [engine](engine) contains wrappers for `oonimkall`, the
measurement engine library;
- [engine-experimental](engine-experimental) allows us
to implement the `experimental` build flavour where you
put the `oonimkall.aar` file you built inside `engine-experimental`
rather than downloading it from Maven Central.
- [engine](engine) contains wrappers for `oonimkall`, the measurement engine library;
- [engine-experimental](engine-experimental) allows us to implement the `experimental` build flavour where you put the `oonimkall.aar` file you built inside `engine-experimental` rather than downloading it from Maven Central.

## Building an apk

Ensure you have Android Studio and Android SDK installed. Build the `devFullRelease`
Ensure you have Android Studio and Android SDK installed. Build the `ooniDevFullRelease`
variant using Android Studio or this command line:

```
./gradlew assembleDevFullRelease
```sh
./gradlew assembleOoniDevFullRelease
```

## Building the app for f-droid

Instead to build the app to stay compliant to F-Droid use `fdroid`, which
contains small tweaks required to have the app accepted by [f-droid](https://f-droid.org/).
Instead to build the app to stay compliant to F-Droid use `fdroid`, which contains small tweaks required to have the app accepted by [f-droid](https://f-droid.org/).

```
./gradlew assembleFdroid
```sh
./gradlew assembleOoniDevFullRelease
```

## Testing

Run unit tests
Run unit tests/

```
./gradlew testStableFullDebug
```sh
./gradlew testOoniStableFullDebug
```

Run instrumented tests

_Note: To also run the automation tests (to generate screenshots), set the Build Config flag
`RUN_AUTOMATION` as true._
_Note: To also run the automation tests (to generate screenshots), set the Build Config flag `RUN_AUTOMATION` as true._

```
./gradlew connectedStableFullDebugAndroidTest
```sh
./gradlew connectedOoniStableFullDebugAndroidTest
```

Generate code coverage report (after all unit and instrumented tests successfully passed)

```
```sh
./gradlew jacocoAndroidTestReport
```
```

## Managing translations

Expand Down
28 changes: 25 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ android {
buildConfigField 'String', 'SOFTWARE_NAME', 'BASE_SOFTWARE_NAME+IS_DEBUG'
buildConfigField 'String', 'COUNTLY_KEY', '"146836f41172f9e3287cab6f2cc347de3f5ddf3b"'
buildConfigField "boolean", "RUN_AUTOMATION", "false"
buildConfigField "boolean", "SHOW_DISABLED_CARDS", "true"
}

buildTypes {
Expand All @@ -46,8 +47,21 @@ android {
}
}

flavorDimensions 'testing', 'license'
flavorDimensions = ['brand', 'testing', 'license']

productFlavors {
ooni {
getIsDefault().set(true)
dimension 'brand'
}
dw {
dimension 'brand'
applicationId 'com.dw.ooniprobe'
resValue "string", "APP_ID", 'com.dw.ooniprobe'
resValue "string", "APP_NAME", "News Media Scan"
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"news-media-scan-android"'
buildConfigField "boolean", "SHOW_DISABLED_CARDS", "false"
}
stable {
dimension 'testing'
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android"'
Expand All @@ -58,7 +72,6 @@ android {
versionNameSuffix resolveVersionSuffix('beta')
versionCode resolveVersionCode()
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 @@ -68,7 +81,6 @@ android {
versionNameSuffix resolveVersionSuffix('experimental')
versionCode resolveVersionCode()
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 All @@ -79,6 +91,16 @@ android {
dimension 'license'
}
}

bundle {
language {
enableSplit = false
}
}

applicationVariants.all { variant ->
variant.resValue "string", "APP_ID", "\"${applicationId}\""
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("fdroid") && (names.contains("experimental") || names.contains("dev"))) {
Expand Down
54 changes: 54 additions & 0 deletions app/src/dw/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<activity
android:name=".activity.InfoActivity"
android:exported="false"
android:label="@string/Settings_About_Label"
android:parentActivityName=".activity.PreferenceActivity"
android:screenOrientation="userPortrait"
android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar.App.NoActionBar">
<intent-filter>
<action android:name=".activity.InfoActivity" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.ProxyActivity"
android:exported="false"
android:label="Proxy"
android:parentActivityName=".activity.PreferenceActivity"
android:screenOrientation="userPortrait"
android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar.App">
<intent-filter>
<action android:name=".activity.ProxyActivity" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.CustomWebsiteActivity"
android:exported="false"
android:label="@string/Settings_Websites_CustomURL_Title"
android:parentActivityName=".activity.PreferenceActivity"
android:screenOrientation="userPortrait">
<intent-filter>
<action android:name=".activity.CustomWebsiteActivity" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.LogActivity"
android:exported="false"
android:label="LogActivity"
android:parentActivityName=".activity.PreferenceActivity">
<intent-filter>
<action android:name=".activity.LogActivity" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
4 changes: 4 additions & 0 deletions app/src/dw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changes required.

- [] Translation updates
- [] Onboarding override
1 change: 1 addition & 0 deletions app/src/dw/assets/anim/websites.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/src/dw/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# News Media Scan Dev
This is a collection of resources to be used by the News Media Scan specific flavors of the application.
A corresponding directory exits in [app/src/ooni](../../ooni).
Loading

0 comments on commit 3106d03

Please sign in to comment.