Skip to content

Commit

Permalink
Merge branch 'release/5.201.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daxtheduck committed May 20, 2024
2 parents 7a862b3 + 4ae5b70 commit 6d8acec
Show file tree
Hide file tree
Showing 133 changed files with 2,574 additions and 206 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/custom-tabs-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Custom Tabs nightly tests

on:
schedule:
- cron: '0 5 * * *' # run at 5 AM UTC
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
instrumentation_tests:
runs-on: ubuntu-latest
name: Custom Tabs nightly tests

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Create folder
if: always()
run: mkdir apk

- name: Decode keys
uses: davidSchuppa/base64Secret-toFile-action@v2
with:
secret: ${{ secrets.FAKE_RELEASE_PROPERTIES }}
fileName: ddg_android_build.properties
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/

- name: Decode key file
uses: davidSchuppa/base64Secret-toFile-action@v2
with:
secret: ${{ secrets.FAKE_RELEASE_KEY }}
fileName: android
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/

- name: Assemble internal release APK
uses: gradle/gradle-build-action@v2
with:
arguments: assembleInternalRelease -Pforce-default-variant -x lint

- name: Move APK to new folder
if: always()
run: find . -name "*.apk" -exec mv '{}' apk/release.apk \;

- name: Custom Tabs Flows
uses: mobile-dev-inc/[email protected]
with:
api-key: ${{ secrets.MOBILE_DEV_API_KEY }}
name: ${{ github.sha }}
app-file: apk/release.apk
android-api-level: 30
workspace: .maestro
include-tags: customTabsTest

- name: Create Asana task when workflow failed
if: ${{ failure() }}
id: create-failure-task
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: GH Workflow Failure - Custom Tabs Flows
asana-task-description: The Custom Tabs nightly workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
action: 'create-asana-task'
2 changes: 1 addition & 1 deletion .maestro/bookmarks/open_bookmark_and_navigate_back.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ tags:
text: "Privacy Test Pages - Home"
- assertVisible:
text: "Privacy Test Pages"
- tapOn: "back"
- action: back
- assertVisible:
text: "Search engine"
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ tags:
text: "Privacy Test Pages - Home"
- assertVisible:
text: "Privacy Test Pages"
- tapOn: "back"
- action: back
- assertVisible:
text: "Search engine"
64 changes: 64 additions & 0 deletions .maestro/custom_tabs/custom_tabs_navigation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
appId: com.duckduckgo.mobile.android
name: "Custom Tabs navigation"
tags:
- customTabsTest
---
- launchApp:
clearState: true
stopApp: true

- assertVisible:
text: ".*Not to worry! Searching and browsing privately.*"
- tapOn: "let's do it!"
- runFlow:
when:
visible: "set as default"
commands:
- tapOn: "duckduckgo"
- tapOn: "set as default"
- assertVisible:
text: ".*I'll also upgrade the security of your connection if possible.*"

- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
text: "settings"
- scrollUntilVisible:
element:
text: "developer settings"
direction: DOWN
- tapOn:
text: "developer settings"
- scrollUntilVisible:
element:
text: "custom tabs"
direction: DOWN
- tapOn:
text: "custom tabs"
- tapOn:
text: "add your url here"
- inputText: "https://www.search-company.site"
- tapOn:
text: "load custom tab"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- assertVisible:
text: "running in duckduckgo"
- action: back
- tapOn:
text: "[Ad 1] SERP Ad (heuristic)"
- action: back
- tapOn:
text: "[Ad 1] SERP Ad (heuristic)"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
id: "com.duckduckgo.mobile.android:id/backMenuItem"
- assertVisible:
text: "Search engine"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
id: "com.duckduckgo.mobile.android:id/forwardMenuItem"
- assertVisible:
text: "Publisher site"
70 changes: 70 additions & 0 deletions .maestro/custom_tabs/custom_tabs_navigation_new_tab.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
appId: com.duckduckgo.mobile.android
name: "Custom Tabs navigation in new tab"
tags:
- customTabsTest
---
- launchApp:
clearState: true
stopApp: true

- assertVisible:
text: ".*Not to worry! Searching and browsing privately.*"
- tapOn: "let's do it!"
- runFlow:
when:
visible: "set as default"
commands:
- tapOn: "duckduckgo"
- tapOn: "set as default"
- assertVisible:
text: ".*I'll also upgrade the security of your connection if possible.*"

- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
text: "settings"
- scrollUntilVisible:
element:
text: "developer settings"
direction: DOWN
- tapOn:
text: "developer settings"
- scrollUntilVisible:
element:
text: "custom tabs"
direction: DOWN
- tapOn:
text: "custom tabs"
- tapOn:
text: "add your url here"
- inputText: "https://www.search-company.site"
- tapOn:
text: "load custom tab"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- assertVisible:
text: "running in duckduckgo"
- action: back
- tapOn:
text: "[Ad 2] Shopping Tab Ad (heuristic)"
- assertVisible:
text: "Publisher site"
- action: back
- tapOn:
text: "[Ad 2] Shopping Tab Ad (heuristic)"
- tapOn:
text: "Red shoes"
- assertVisible:
text: "Checkout"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
id: "com.duckduckgo.mobile.android:id/backMenuItem"
- assertVisible:
text: "Red shoes"
- tapOn:
id: "com.duckduckgo.mobile.android:id/browserMenuImageView"
- tapOn:
id: "com.duckduckgo.mobile.android:id/forwardMenuItem"
- assertVisible:
text: "Checkout"
5 changes: 1 addition & 4 deletions app-tracking-protection/vpn-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ dependencies {
implementation project(':statistics')
implementation project(':library-loader-api')
implementation project(':network-protection-api')
implementation project(':data-store-api')

implementation AndroidX.core.ktx

Expand All @@ -80,10 +81,6 @@ dependencies {

// multi-process shared preferences
implementation "com.frybits.harmony:harmony:_"
implementation 'com.frybits.harmony:harmony-crypto:_'

// Security crypto
implementation AndroidX.security.crypto

// Lottie
implementation "com.airbnb.android:lottie:_"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.mobile.android.vpn.prefs.VpnSharedPreferencesProvider
import com.duckduckgo.data.store.api.SharedPreferencesProvider
import com.duckduckgo.mobile.android.vpn.service.TrackerBlockingVpnService
import java.util.UUID
import kotlinx.coroutines.sync.Mutex
Expand All @@ -32,7 +32,7 @@ private const val IS_INITIALIZED = "IS_INITIALIZED"

internal class VpnFeaturesRegistryImpl(
private val vpnServiceWrapper: VpnServiceWrapper,
private val sharedPreferencesProvider: VpnSharedPreferencesProvider,
private val sharedPreferencesProvider: SharedPreferencesProvider,
private val dispatcherProvider: DispatcherProvider,
) : VpnFeaturesRegistry {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.duckduckgo.mobile.android.vpn.bugreport

import android.content.Context
import android.content.SharedPreferences
import android.net.*
import android.os.SystemClock
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.ActivityScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.appbuildconfig.api.isInternalBuild
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.common.utils.checkMainThread
import com.duckduckgo.data.store.api.SharedPreferencesProvider
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.di.scopes.VpnScope
import com.duckduckgo.mobile.android.vpn.AppTpVpnFeature
import com.duckduckgo.mobile.android.vpn.VpnFeaturesRegistry
import com.duckduckgo.mobile.android.vpn.prefs.VpnSharedPreferencesProvider
import com.duckduckgo.mobile.android.vpn.service.VpnServiceCallbacks
import com.duckduckgo.mobile.android.vpn.state.VpnStateMonitor.VpnStopReason
import com.squareup.anvil.annotations.ContributesBinding
Expand Down Expand Up @@ -61,7 +61,7 @@ interface CohortStore {
boundType = VpnServiceCallbacks::class,
)
class RealCohortStore @Inject constructor(
private val sharedPreferencesProvider: VpnSharedPreferencesProvider,
private val sharedPreferencesProvider: SharedPreferencesProvider,
private val vpnFeaturesRegistry: VpnFeaturesRegistry,
private val dispatcherProvider: DispatcherProvider,
private val appBuildConfig: AppBuildConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import android.content.res.Resources
import android.net.ConnectivityManager
import androidx.room.Room
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.data.store.api.SharedPreferencesProvider
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.mobile.android.vpn.Vpn
import com.duckduckgo.mobile.android.vpn.VpnFeaturesRegistry
import com.duckduckgo.mobile.android.vpn.VpnFeaturesRegistryImpl
import com.duckduckgo.mobile.android.vpn.VpnServiceWrapper
import com.duckduckgo.mobile.android.vpn.prefs.VpnSharedPreferencesProvider
import com.duckduckgo.mobile.android.vpn.stats.AppTrackerBlockingStatsRepository
import com.duckduckgo.mobile.android.vpn.stats.RealAppTrackerBlockingStatsRepository
import com.duckduckgo.mobile.android.vpn.store.*
Expand Down Expand Up @@ -92,7 +92,7 @@ object VpnAppModule {
@SingleInstanceIn(AppScope::class)
fun provideVpnFeaturesRegistry(
context: Context,
sharedPreferencesProvider: VpnSharedPreferencesProvider,
sharedPreferencesProvider: SharedPreferencesProvider,
dispatcherProvider: DispatcherProvider,
): VpnFeaturesRegistry {
return VpnFeaturesRegistryImpl(VpnServiceWrapper(context, dispatcherProvider), sharedPreferencesProvider, dispatcherProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import androidx.core.content.edit
import com.duckduckgo.anvil.annotations.ContributesRemoteFeature
import com.duckduckgo.app.di.AppCoroutineScope
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.data.store.api.SharedPreferencesProvider
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.feature.toggles.api.RemoteFeatureStoreNamed
import com.duckduckgo.feature.toggles.api.Toggle
import com.duckduckgo.feature.toggles.api.Toggle.DefaultValue
import com.duckduckgo.feature.toggles.api.Toggle.State
import com.duckduckgo.mobile.android.vpn.feature.settings.ExceptionListsSettingStore
import com.duckduckgo.mobile.android.vpn.prefs.VpnSharedPreferencesProvider
import com.squareup.anvil.annotations.ContributesBinding
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
Expand Down Expand Up @@ -63,14 +63,14 @@ interface AppTpRemoteFeatures {
class AppTpRemoteFeaturesStore @Inject constructor(
@AppCoroutineScope private val coroutineScope: CoroutineScope,
private val dispatcherProvider: DispatcherProvider,
private val vpnSharedPreferencesProvider: VpnSharedPreferencesProvider,
private val sharedPreferencesProvider: SharedPreferencesProvider,
moshi: Moshi,
) : Toggle.Store {

private val togglesCache = ConcurrentHashMap<String, State>()

private val preferences: SharedPreferences by lazy {
vpnSharedPreferencesProvider.getSharedPreferences(PREFS_FILENAME, multiprocess = true, migrate = false)
sharedPreferencesProvider.getSharedPreferences(PREFS_FILENAME, multiprocess = true, migrate = false)
}
private val stateAdapter: JsonAdapter<State> by lazy {
moshi.newBuilder().add(KotlinJsonAdapterFactory()).build().adapter(State::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ enum class DeviceShieldPixelNames(override val pixelName: String, val enqueue: B
ATP_DID_REPORT_ISSUES_FROM_TRACKER_ACTIVITY_DAILY("m_atp_imp_tracker_activity_report_issues_d"),

ATP_APP_BREAKAGE_REPORT("m_atp_breakage_report"),
ATP_APP_BREAKAGE_REPORT_DAILY("m_atp_breakage_report_d"),
ATP_APP_BREAKAGE_REPORT_UNIQUE("m_atp_breakage_report_u"),
ATP_APP_CPU_MONITOR_REPORT("m_atp_ev_cpu_usage_above_%d"),

Expand Down Expand Up @@ -222,5 +223,7 @@ enum class DeviceShieldPixelNames(override val pixelName: String, val enqueue: B
VPN_SNOOZE_ENDED_DAILY("m_vpn_ev_snooze_ended_d", enqueue = true),

VPN_MOTO_G_FIX_DAILY("m_vpn_ev_moto_g_fix_d", enqueue = true),
VPN_START_ATTEMPT("m_vpn_ev_start_attempt_c", enqueue = true),
VPN_START_ATTEMPT_FAILURE("m_vpn_ev_start_attempt_failure_c", enqueue = true),
;
}
Loading

0 comments on commit 6d8acec

Please sign in to comment.