Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add News Media Scan flavor #549

Merged
merged 54 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
36cc6f8
Initial protorype for DW Media Probe
aanorbel Dec 12, 2022
bd06bc6
added sample logo
aanorbel Dec 13, 2022
87191eb
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Dec 14, 2022
2c1887b
updated with actual project information
aanorbel Dec 20, 2022
2097475
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Dec 21, 2022
0b17422
modified preferences
aanorbel Dec 21, 2022
383a55f
modified default preferrences
aanorbel Dec 26, 2022
9dfe80d
updated logo scaling for info page
aanorbel Jan 11, 2023
28885eb
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Feb 20, 2023
39b485f
updated version system
aanorbel Feb 20, 2023
50bc494
updated enabled categories
aanorbel Feb 23, 2023
013c5fd
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Feb 24, 2023
f02efb7
changed provider authorities
aanorbel Feb 28, 2023
4da10f3
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Mar 20, 2023
d49ed61
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Mar 30, 2023
1d14339
fix: webconectivity progress error and updated default database for d…
aanorbel Apr 3, 2023
f8fe1c5
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Jun 29, 2023
47175e5
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Jul 28, 2023
50b4fa6
changed overides based on new properties in app
aanorbel Jul 28, 2023
dfc2753
Updated logo
aanorbel Aug 1, 2023
f006382
Merge branch 'issue/1989-update' of github.com:ooni/probe-android int…
aanorbel Aug 1, 2023
6b7b0a9
updated preference intents
aanorbel Aug 1, 2023
1e9e3dc
updated onboarding page
aanorbel Aug 1, 2023
981699c
updated info activity
aanorbel Aug 1, 2023
d4390cf
updated theme with night mode colors
aanorbel Aug 1, 2023
9c34754
updated dialog and strings
aanorbel Aug 2, 2023
782e5f9
Updated dashboard logo to use xml file and update dashboard layout
aanorbel Aug 7, 2023
254322a
Updated string overides for onboarding pages
aanorbel Aug 11, 2023
bf75c4b
Updated the theme for `WebConnectivity` to use the base color theme f…
aanorbel Sep 6, 2023
d3a51bf
Updated dashboard to remove disabled cards based on build config
aanorbel Sep 7, 2023
69b7170
Updated about activity
aanorbel Sep 8, 2023
90d1326
Updated copy to use latest from DW Team
aanorbel Sep 11, 2023
8e7b12e
Updated copy
aanorbel Sep 11, 2023
dd58288
Updated copy and removed unnecesary text
aanorbel Sep 11, 2023
1a3751b
Updated asset animation and about page
aanorbel Sep 21, 2023
39cb657
Updated icon and resource file
aanorbel Sep 21, 2023
9e1cf64
Updated version code
aanorbel Sep 21, 2023
bb5f327
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Nov 17, 2023
4964560
Update app for release 3.8.5
aanorbel Nov 28, 2023
4650b5a
Merge branch 'releases/3.8.5' of github.com:ooni/probe-android into d…
aanorbel Nov 28, 2023
50f9d4b
Chore: Updated flavor definition to allow resource separation (#634)
aanorbel Dec 5, 2023
38d85b5
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Dec 5, 2023
a16dd05
Updated app to display disabled dashboard items based on build config
aanorbel Dec 5, 2023
b919961
Updated translations
aanorbel Feb 13, 2024
57a90cb
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Feb 13, 2024
b0d0f5d
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Mar 26, 2024
ca23927
chore: Updated translations for News Media Scan
aanorbel Mar 27, 2024
2f1406f
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Apr 10, 2024
7fbfd60
fix(NMS): update supported languages
aanorbel Apr 11, 2024
ca5ee3f
chore: remove bundle splitting for languages.
aanorbel Apr 29, 2024
f150e8d
chore: update language code
aanorbel Apr 29, 2024
6906084
fix: language decoding from string representation
aanorbel Apr 30, 2024
2a30bc4
chore: updated ci flow to include news media scan
aanorbel Apr 30, 2024
5700b4c
Merge branch 'master' of github.com:ooni/probe-android into dw-media-…
aanorbel Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test whether it's possible to install the dw-flavoured-app and ooniprobe side by side? As far as I know, it is currently not possible to install OONI Probe stable and OONI Probe experimental side by side. While that may be acceptable because it's only us who install the experimental app, not allowing installation side by side will be a bit more confusing for people. That said, also allowing installing side-by-side is weird because we are going to have tow ~ooniprobe apps competing for collecting measurements. Did you spend time thinking about which would be the best way to handle this side by side scenario?

<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
Loading