diff --git a/.cron.yml b/.cron.yml deleted file mode 100644 index afe516d..0000000 --- a/.cron.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Definitions for jobs that run periodically. For details on the format, see -# `taskcluster/taskgraph/cron/schema.py`. For documentation, see -# `taskcluster/docs/cron.rst`. ---- - -jobs: - - name: fennec-production - job: - type: decision-task - treeherder-symbol: fennec-production - target-tasks-method: fennec-production - when: [] # Force hook only - - name: bump-android-components - job: - type: decision-task - treeherder-symbol: bump-ac - target-tasks-method: bump_android_components - when: [{hour: 15, minute: 30}] - - name: screenshots - job: - type: decision-task - treeherder-symbol: screenshots-D - target-tasks-method: screenshots - when: [{weekday: 'Monday', hour: 10, minute: 0}] - - name: legacy-api-ui-tests - job: - type: decision-task - treeherder-symbol: legacy-api-ui - target-tasks-method: legacy_api_ui_tests - when: [{hour: 10, minute: 30}] diff --git a/.gitignore b/.gitignore index f26fda5..5a86b8a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,9 @@ # Java class files *.class +# Kotlin +.kotlin + # Generated files bin/ gen/ @@ -83,13 +86,17 @@ gen-external-apklibs .mls_token .wallpaper_url +# Google Play Publisher credentials +play-service-account.json +*.p12 + # Python Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] venv/ -# UI test artifacts +# UI test artifacts .firebase_token* results/ test_artifacts/ diff --git a/.mergify.yml b/.mergify.yml deleted file mode 100644 index afa6fe1..0000000 --- a/.mergify.yml +++ /dev/null @@ -1,100 +0,0 @@ -queue_rules: - - name: default - conditions: - - or: - - status-success=complete-pr - - and: - # For more context, see "Auto Merge" rules down below - - base~=^releases[_/].* - - status-success=complete-push - - or: - - head~=^automation/sync-strings-\d+ - - head~=^relbot/fenix-\d+ -pull_request_rules: - - name: Resolve conflict - conditions: - - conflict - actions: - comment: - message: This pull request has conflicts when rebasing. Could you fix it @{{author}}? 🙏 - - name: Android-Components bump - Auto Merge - conditions: - - and: - - files=buildSrc/src/main/java/AndroidComponents.kt - - -files~=^(?!buildSrc/src/main/java/AndroidComponents.kt).+$ - - or: - - and: - - author=MickeyMoz - - base=main - - head=ac-update - - status-success=complete-pr - - and: - - author=github-actions[bot] - - base~=^releases[_/].* - - head~=^relbot/fenix-\d+ - - status-success=complete-push - actions: - review: - type: APPROVE - message: 🚢 - queue: - method: rebase - name: default - rebase_fallback: none - - name: L10N - Auto Merge - conditions: - - and: - - files~=^(l10n.toml|app/src/main/res/values[A-Za-z-]*/strings\.xml)$ - # /!\ The line above doesn't prevent random files to be changed alongside - # l10n ones. That's why the additional condition exists below. For more - # information: https://docs.mergify.com/conditions/#how-to-match-lists - - -files~=^(?!(l10n.toml|app/src/main/res/values[A-Za-z-]*/strings\.xml)).+$ - - or: - - and: - - author=mozilla-l10n-automation-bot - - base=main - - head=import-l10n - - status-success=complete-pr - - and: - - author=github-actions[bot] - - base~=^releases[_/].* - - head~=^automation/sync-strings-\d+ - - status-success=complete-push - # Taskcluster only runs on git-push events because github-actions[bot] is not considered - # a collaborator, so pull request events are triggered. That said, github-actions[bot] - # doesn't create the PR on a separate fork (unlike mozilla-l10n-automation-bot). That's - # why git-push events are taken into account - actions: - review: - type: APPROVE - message: LGTM 😎 - queue: - method: rebase - name: default - rebase_fallback: none - - name: Needs landing - Rebase - conditions: - - check-success=complete-pr - - label=pr:needs-landing - - "#approved-reviews-by>=1" - - -draft - - label!=pr:work-in-progress - - label!=pr:do-not-land - actions: - queue: - method: rebase - name: default - rebase_fallback: none - - name: Needs landing - Squash - conditions: - - check-success=complete-pr - - label=pr:needs-landing-squashed - - "#approved-reviews-by>=1" - - -draft - - label!=pr:work-in-progress - - label!=pr:do-not-land - actions: - queue: - method: squash - name: default - rebase_fallback: none diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 498baa3..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,15 +0,0 @@ -# Community Participation Guidelines - -This repository is governed by Mozilla's code of conduct and etiquette guidelines. -For more details, please read the -[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). - -## How to Report -For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page. - - diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 7a118b4..0000000 --- a/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://rubygems.org" - -gem "fastlane" diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index ee4cb08..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,53 +0,0 @@ -pipeline { - agent any - triggers { - cron(env.BRANCH_NAME == 'main' ? 'H 0 * * *' : '') - } - options { - timestamps() - timeout(time: 1, unit: 'HOURS') - } - stages { - stage('test') { - when { branch 'main' } - steps { - dir('app/src/androidTest/java/net/waterfox/android/syncIntegration') { - sh 'pipenv install' - sh 'pipenv check' - sh 'pipenv run pytest' - } - } - } - } - post { - always { - script { - if (env.BRANCH_NAME == 'main') { - publishHTML(target: [ - allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true, - reportDir: 'app/src/androidTest/java/net/waterfox/android/syncintegration/results', - reportFiles: 'index.html', - reportName: 'HTML Report']) - } - } - } - - failure { - script { - if (env.BRANCH_NAME == 'main') { - slackSend( - color: 'danger', - message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL}HTML_20Report/)") - } - } - } - - fixed { - slackSend( - color: 'good', - message: "FIXED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL}HTML_20Report/)") - } - } -} diff --git a/README.md b/README.md index 611735c..574423a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,128 @@ The all-new Waterfox for Android browser is based on [GeckoView](https://mozilla ## License - This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/ + +## Building with Local Android Components + +To build Waterfox for Android with local Android components - as opposed to via Android Studio and Mozilla's Maven respository - you'll first need to build GeckoView from source and then build Waterfox for Android itself, pointing it to your local GeckoView build. + +These instructions are based on if you were to start from a clean Linux distribution installation. + +### 1. Clone and Prepare GeckoView + +First, clone the Firefox repository (which contains GeckoView). These instructions assume you will clone it into a directory named `firefox`. We do not care about the commit history, so we are shallow cloning. + +```shell +git clone --depth 1 --branch release https://github.com/mozilla-firefox/firefox/ +cd firefox +``` + +### 2. Install Python Dependencies + +Ensure you have `python3-pip` installed, which is required by Mozilla's build scripts. + +```shell +sudo apt-get install python3-pip +``` + +### 3. Bootstrap GeckoView + +Run the `mach` bootstrap command to set up the build environment for GeckoView specifically for Android. + +```shell +./mach --no-interactive bootstrap --application-choice="GeckoView/Firefox for Android" +``` + +### 4. Configure the GeckoView Build + +Create a `.mozconfig` file in the `firefox` directory with the necessary build options. This configuration enables the Android mobile project, optimizes the build, disables debug symbols, and enables GeckoView Lite. + +```shell +rm -f mozconfig +cat > .mozconfig << 'EOF' +ac_add_options --enable-project=mobile/android +ac_add_options --enable-optimize +ac_add_options --disable-debug +ac_add_options --enable-geckoview-lite +EOF +``` + +### 5. Build GeckoView + +Compile GeckoView and its binaries. This can take a significant amount of time. + +```shell +./mach build && ./mach build binaries +``` + +### 6. Publish GeckoView to Maven Local + +Publish the GeckoView and Exoplayer2 artifacts to your local Maven repository. This makes them accessible to the Waterfox for Android build system. + +```shell +./mach gradle geckoview:publishDebugPublicationToMavenLocal +./mach gradle exoplayer2:publishDebugPublicationToMavenLocal +``` + +### 7. Clone Waterfox-Android + +Navigate out of the `firefox` directory (or whatever you named your GeckoView clone) and clone the Waterfox-Android repository. + +```shell +cd ../ +git clone git@github.com:BrowserWorks/Waterfox-Android.git +cd Waterfox-Android +``` + +### 8. Configure Local Properties for Waterfox-Android + +Create a `local.properties` file in the root of the `Waterfox-Android` project. This file tells the Waterfox build system where to find your locally built GeckoView. + +Execute the following command in the `Waterfox-Android` directory: + +```shell +cat > local.properties << 'EOF' +dependencySubstitutions.geckoviewTopsrcdir=/home/$USER/firefox +dependencySubstitutions.geckoviewTopobjdir=/home/$USER/firefox/obj-$TRIPLET +EOF +``` + +The `dependencySubstitutions.geckoviewTopsrcdir` path should point to the root of your GeckoView source code (e.g., the `firefox` directory you cloned in Step 1). The `dependencySubstitutions.geckoviewTopobjdir` path should point to the object directory within your GeckoView build, which is typically `obj-` followed by your architecture triplet (e.g., `obj-x86_64-unknown-linux-android`). + +For example, if you cloned GeckoView to `/workspace/firefox` and your object directory is `/workspace/firefox/obj-x86_64-unknown-linux-android`, your `local.properties` would look like: + +```Waterfox-Android/local.properties#L1-2 +dependencySubstitutions.geckoviewTopsrcdir=/workspace/firefox +dependencySubstitutions.geckoviewTopobjdir=/workspace/firefox/obj-x86_64-unknown-linux-android +``` + +### 9. Set Environment Variables + +Set the `JAVA_HOME` and `ANDROID_HOME` environment variables. The paths shown below are typical for a `.mozbuild` setup (created during GeckoView bootstrap) but might differ on your system. Ensure these point to a JDK 17 and a valid Android SDK. + +```shell +# These paths might differ based on your .mozbuild setup +export JAVA_HOME=$HOME/.mozbuild/jdk/jdk-17.0.13+11/ # Or your JDK 17 path +export ANDROID_HOME=$HOME/.mozbuild/android-sdk-linux/ # Or your Android SDK path +``` + +### 10. Build Waterfox-Android + +Finally, clean and build the Waterfox for Android application. + +To build a **debug** version: + +```shell +./gradlew clean app:assembleDebug +``` + +To build a **release** version: + +```shell +./gradlew clean app:assembleRelease +``` + +Note: For release builds, you will need to have set up signing configurations as per standard Android development practices. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 7c259dd..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security Policy - -## Reporting a Vulnerability - -Report all security vunerablites to [Bugzilla Fenix::Security](https://bugzilla.mozilla.org/enter_bug.cgi?product=Fenix&component=Security). If they are not a security bug you will be asked to move your report to [Fenix GitHub](https://github.com/mozilla-mobile/fenix/issues). See the [Mozilla Security Bug Bounty Program](https://www.mozilla.org/en-US/security/bug-bounty/) and the [client security reporting](https://www.mozilla.org/en-US/security/client-bug-bounty/) pages for details. In any case where this document and the Mozilla.org pages differ the Mozilla.org pages are the official documentation. diff --git a/app/build.gradle b/app/build.gradle index 667904b..01d6471 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,16 +2,31 @@ import com.android.build.OutputFile import groovy.json.JsonOutput import net.waterfox.android.gradle.tasks.ApkSizeTask + plugins { + alias libs.plugins.android.application + alias libs.plugins.kotlin.android + alias libs.plugins.androidx.safeargs + alias libs.plugins.kotlin.parcelize + alias libs.plugins.compose.compiler + alias libs.plugins.play.publisher id "com.jetbrains.python.envs" version "0.0.26" + id 'jacoco' + id 'com.google.android.gms.oss-licenses-plugin' + id("app.accrescent.tools.bundletool") version "0.2.4" } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' -apply plugin: 'jacoco' -apply plugin: 'androidx.navigation.safeargs.kotlin' -apply plugin: 'com.google.android.gms.oss-licenses-plugin' +bundletool { + // Only configure signing if the KEYSTORE environment variable is set + if (System.getenv("KEYSTORE") != null) { + signingConfig { + storeFile = file(System.getenv("KEYSTORE")) + storePassword = System.getenv("KEYSTORE_PWD") + keyAlias = System.getenv("KEY_ALIAS") + keyPassword = System.getenv("KEY_ALIAS_PWD") + } + } +} import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory @@ -20,6 +35,16 @@ import static org.gradle.api.tasks.testing.TestResult.ResultType apply from: 'benchmark.gradle' +play { + // The plugin will read the service account credentials from the + // ANDROID_PUBLISHER_CREDENTIALS environment variable if it's set + enabled.set(gradle.hasProperty("enablePlayPublisher") || System.getenv("ANDROID_PUBLISHER_CREDENTIALS") != null) + + // Only publish release builds + defaultToAppBundles.set(true) + track.set("internal") // Start with internal track for safety +} + android { project.maybeConfigForJetpackBenchmark(it) if (project.hasProperty("testBuildType")) { @@ -43,7 +68,7 @@ android { buildConfigField "String", "GIT_HASH", "\"\"" // see override in release builds for why it's blank. // This should be the "public" base URL of AMO. buildConfigField "String", "AMO_BASE_URL", "\"https://addons.mozilla.org\"" - buildConfigField "String", "AMO_COLLECTION_NAME", "\"Waterfox-Android\"" + buildConfigField "String", "AMO_COLLECTION_NAME", "\"LeOSium-Android\"" buildConfigField "String", "AMO_COLLECTION_USER", "\"17224042\"" // This should be the base URL used to call the AMO API. buildConfigField "String", "AMO_SERVER_URL", "\"https://services.addons.mozilla.org\"" @@ -84,6 +109,7 @@ android { applicationIdSuffix ".debug" resValue "bool", "IS_DEBUG", "true" pseudoLocalesEnabled true + testCoverageEnabled true } release releaseTemplate >> { buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" @@ -119,7 +145,13 @@ android { animationsDisabled = true } - flavorDimensions "engine" + flavorDimensions.add("product") + + productFlavors { + waterfox { + dimension "product" + } + } sourceSets { androidTest { @@ -140,6 +172,7 @@ android { compileOptions { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 + coreLibraryDesugaringEnabled true } lint { @@ -229,7 +262,7 @@ android.applicationVariants.all { variant -> buildConfigField 'String', 'SENTRY_TOKEN', 'null' if (!isDebug) { - buildConfigField 'boolean', 'CRASH_REPORTING', 'true' + buildConfigField 'boolean', 'CRASH_REPORTING', 'false' // Reading sentry token from local file (if it exists). In a release task on Fastlane it will be available. try { def token = new File("${rootDir}/.sentry_token").text.trim() @@ -304,145 +337,146 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { } dependencies { - implementation Deps.mozilla_browser_engine_gecko + implementation libs.mozilla.browser.engine.gecko - implementation Deps.kotlin_stdlib - implementation Deps.kotlin_coroutines - implementation Deps.kotlin_coroutines_android - testImplementation Deps.kotlin_coroutines_test - implementation Deps.androidx_appcompat - implementation Deps.androidx_activity_compose - implementation Deps.androidx_constraintlayout - implementation Deps.androidx_coordinatorlayout - implementation Deps.google_accompanist_drawablepainter - implementation Deps.google_accompanist_insets - implementation Deps.google_accompanist_swiperefresh - implementation Deps.coil + implementation libs.kotlin.stdlib + implementation libs.kotlin.coroutines + implementation libs.kotlin.coroutines.android + testImplementation libs.kotlin.coroutines.test + implementation libs.androidx.appcompat + implementation libs.androidx.activity.compose + implementation libs.androidx.constraintlayout + implementation libs.androidx.coordinatorlayout + implementation libs.google.accompanist.drawablepainter + implementation libs.google.accompanist.insets + implementation libs.google.accompanist.swiperefresh + implementation libs.coil -// implementation Deps.sentry +// implementation libs.sentry - implementation Deps.mozilla_compose_awesomebar + implementation libs.mozilla.compose.awesomebar - implementation Deps.mozilla_concept_awesomebar - implementation Deps.mozilla_concept_base - implementation Deps.mozilla_concept_engine - implementation Deps.mozilla_concept_menu - implementation Deps.mozilla_concept_push - implementation Deps.mozilla_concept_storage - implementation Deps.mozilla_concept_sync - implementation Deps.mozilla_concept_toolbar - implementation Deps.mozilla_concept_tabstray + implementation libs.mozilla.concept.awesomebar + implementation libs.mozilla.concept.base + implementation libs.mozilla.concept.engine + implementation libs.mozilla.concept.menu + implementation libs.mozilla.concept.push + implementation libs.mozilla.concept.storage + implementation libs.mozilla.concept.sync + implementation libs.mozilla.concept.toolbar + implementation libs.mozilla.concept.tabstray - implementation Deps.mozilla_browser_domains - implementation Deps.mozilla_browser_icons - implementation Deps.mozilla_browser_menu - implementation Deps.mozilla_browser_menu2 - implementation Deps.mozilla_browser_session_storage - implementation Deps.mozilla_browser_state - implementation Deps.mozilla_browser_storage_sync - implementation Deps.mozilla_browser_tabstray - implementation Deps.mozilla_browser_thumbnails - implementation Deps.mozilla_browser_toolbar + implementation libs.mozilla.browser.domains + implementation libs.mozilla.browser.icons + implementation libs.mozilla.browser.menu + implementation libs.mozilla.browser.menu2 + implementation libs.mozilla.browser.session.storage + implementation libs.mozilla.browser.state + implementation libs.mozilla.browser.storage.sync + implementation libs.mozilla.browser.tabstray + implementation libs.mozilla.browser.thumbnails + implementation libs.mozilla.browser.toolbar - implementation Deps.mozilla_feature_addons - implementation Deps.mozilla_feature_accounts - implementation Deps.mozilla_feature_app_links - implementation Deps.mozilla_feature_autofill - implementation Deps.mozilla_feature_awesomebar - implementation Deps.mozilla_feature_contextmenu - implementation Deps.mozilla_feature_customtabs - implementation Deps.mozilla_feature_downloads - implementation Deps.mozilla_feature_intent - implementation Deps.mozilla_feature_media - implementation Deps.mozilla_feature_prompts - implementation Deps.mozilla_feature_push - implementation Deps.mozilla_feature_privatemode - implementation Deps.mozilla_feature_pwa - implementation Deps.mozilla_feature_qr - implementation Deps.mozilla_feature_search - implementation Deps.mozilla_feature_session - implementation Deps.mozilla_feature_syncedtabs - implementation Deps.mozilla_feature_toolbar - implementation Deps.mozilla_feature_tabs - implementation Deps.mozilla_feature_findinpage - implementation Deps.mozilla_feature_logins - implementation Deps.mozilla_feature_site_permissions - implementation Deps.mozilla_feature_readerview - implementation Deps.mozilla_feature_tab_collections - implementation Deps.mozilla_feature_recentlyclosed - implementation Deps.mozilla_feature_top_sites - implementation Deps.mozilla_feature_share - implementation Deps.mozilla_feature_accounts_push - implementation Deps.mozilla_feature_webauthn - implementation Deps.mozilla_feature_webcompat - implementation Deps.mozilla_feature_webnotifications - implementation Deps.mozilla_feature_webcompat_reporter + implementation libs.mozilla.feature.addons + implementation libs.mozilla.feature.accounts + implementation libs.mozilla.feature.app.links + implementation libs.mozilla.feature.autofill + implementation libs.mozilla.feature.awesomebar + implementation libs.mozilla.feature.contextmenu + implementation libs.mozilla.feature.customtabs + implementation libs.mozilla.feature.downloads + implementation libs.mozilla.feature.intent + implementation libs.mozilla.feature.media + implementation libs.mozilla.feature.prompts + implementation libs.mozilla.feature.push + implementation libs.mozilla.feature.privatemode + implementation libs.mozilla.feature.pwa + implementation libs.mozilla.feature.qr + implementation libs.mozilla.feature.search + implementation libs.mozilla.feature.session + implementation libs.mozilla.feature.syncedtabs + implementation libs.mozilla.feature.toolbar + implementation libs.mozilla.feature.tabs + implementation libs.mozilla.feature.findinpage + implementation libs.mozilla.feature.logins + implementation libs.mozilla.feature.site.permissions + implementation libs.mozilla.feature.readerview + implementation libs.mozilla.feature.tab.collections + implementation libs.mozilla.feature.recentlyclosed + implementation libs.mozilla.feature.top.sites + implementation libs.mozilla.feature.share + implementation libs.mozilla.feature.accounts.push + implementation libs.mozilla.feature.webauthn + implementation libs.mozilla.feature.webcompat + implementation libs.mozilla.feature.webnotifications + implementation libs.mozilla.feature.webcompat.reporter - implementation Deps.mozilla_service_mars - implementation Deps.mozilla_service_digitalassetlinks - implementation Deps.mozilla_service_sync_autofill - implementation Deps.mozilla_service_sync_logins - implementation Deps.mozilla_service_firefox_accounts - implementation Deps.mozilla_service_location + implementation libs.mozilla.service.mars + implementation libs.mozilla.service.digitalassetlinks + implementation libs.mozilla.service.sync.autofill + implementation libs.mozilla.service.sync.logins + implementation libs.mozilla.service.firefox.accounts + implementation libs.mozilla.service.location - implementation Deps.mozilla_support_extensions - implementation Deps.mozilla_support_base - implementation Deps.mozilla_support_rusterrors - implementation Deps.mozilla_support_images - implementation Deps.mozilla_support_ktx - implementation Deps.mozilla_support_rustlog - implementation Deps.mozilla_support_utils - implementation Deps.mozilla_support_locale + implementation libs.mozilla.support.extensions + implementation libs.mozilla.support.base + implementation libs.mozilla.support.rusterrors + implementation libs.mozilla.support.images + implementation libs.mozilla.support.ktx + implementation libs.mozilla.support.rustlog + implementation libs.mozilla.support.utils + implementation libs.mozilla.support.locale - implementation Deps.mozilla_ui_colors - implementation Deps.mozilla_ui_icons - implementation Deps.mozilla_lib_publicsuffixlist - implementation Deps.mozilla_ui_widgets - implementation Deps.mozilla_ui_tabcounter + implementation libs.mozilla.ui.colors + implementation libs.mozilla.ui.icons + implementation libs.mozilla.lib.publicsuffixlist + implementation libs.mozilla.ui.widgets + implementation libs.mozilla.ui.tabcounter - implementation Deps.mozilla_lib_crash - implementation Deps.lib_crash_sentry - implementation Deps.mozilla_lib_state - implementation Deps.mozilla_lib_dataprotect - debugImplementation Deps.leakcanary + implementation libs.mozilla.lib.crash +// implementation libs.lib.crash.sentry + implementation libs.mozilla.lib.push.firebase + implementation libs.mozilla.lib.state + implementation libs.mozilla.lib.dataprotect + debugImplementation libs.leakcanary - implementation Deps.androidx_compose_ui - implementation Deps.androidx_compose_ui_tooling - implementation Deps.androidx_compose_foundation - implementation Deps.androidx_compose_material - implementation Deps.androidx_compose_paging - implementation Deps.androidx_legacy - implementation Deps.androidx_biometric - implementation Deps.androidx_paging - implementation Deps.androidx_preference - implementation Deps.androidx_fragment - implementation Deps.androidx_navigation_fragment - implementation Deps.androidx_navigation_ui - implementation Deps.androidx_recyclerview - implementation Deps.androidx_lifecycle_common - implementation Deps.androidx_lifecycle_livedata - implementation Deps.androidx_lifecycle_process - implementation Deps.androidx_lifecycle_runtime - implementation Deps.androidx_lifecycle_viewmodel - implementation Deps.androidx_core - implementation Deps.androidx_core_ktx - implementation Deps.androidx_transition - implementation Deps.androidx_work_ktx - implementation Deps.androidx_datastore - implementation Deps.google_material + implementation libs.androidx.compose.ui + implementation libs.androidx.compose.ui.tooling + implementation libs.androidx.compose.foundation + implementation libs.androidx.compose.material + implementation libs.androidx.compose.paging + implementation libs.androidx.legacy + implementation libs.androidx.biometric + implementation libs.androidx.paging + implementation libs.androidx.preference + implementation libs.androidx.fragment + implementation libs.androidx.navigation.fragment + implementation libs.androidx.navigation.ui + implementation libs.androidx.recyclerview + implementation libs.androidx.lifecycle.common + implementation libs.androidx.lifecycle.livedata + implementation libs.androidx.lifecycle.process + implementation libs.androidx.lifecycle.runtime + implementation libs.androidx.lifecycle.viewmodel + implementation libs.androidx.core + implementation libs.androidx.core.ktx + implementation libs.androidx.transition + implementation libs.androidx.work.ktx + implementation libs.androidx.datastore + implementation libs.google.material - androidTestImplementation Deps.uiautomator + androidTestImplementation libs.uiautomator androidTestImplementation "tools.fastlane:screengrab:2.0.0" // This Falcon version is added to maven central now required for Screengrab implementation 'com.jraska:falcon:2.2.0' - androidTestImplementation Deps.androidx_compose_ui_test + androidTestImplementation libs.androidx.compose.ui.test.manifest - androidTestImplementation Deps.espresso_core, { + androidTestImplementation libs.espresso.core, { exclude group: 'com.android.support', module: 'support-annotations' } - androidTestImplementation(Deps.espresso_contrib) { + androidTestImplementation libs.espresso.contrib, { exclude module: 'appcompat-v7' exclude module: 'support-v4' exclude module: 'support-annotations' @@ -452,37 +486,40 @@ dependencies { exclude module: 'protobuf-lite' } - androidTestImplementation Deps.androidx_test_core - androidTestImplementation Deps.espresso_idling_resources - androidTestImplementation Deps.espresso_intents + androidTestImplementation libs.androidx.test.core + androidTestImplementation libs.espresso.idling.resources + androidTestImplementation libs.espresso.intents - androidTestImplementation Deps.tools_test_runner - androidTestImplementation Deps.tools_test_rules - androidTestUtil Deps.orchestrator - androidTestImplementation Deps.espresso_core, { + androidTestImplementation libs.tools.test.runner + androidTestImplementation libs.tools.test.rules + androidTestUtil libs.orchestrator + androidTestImplementation libs.espresso.core, { exclude group: 'com.android.support', module: 'support-annotations' } - androidTestImplementation Deps.androidx_junit - androidTestImplementation Deps.androidx_test_extensions - androidTestImplementation Deps.androidx_work_testing - androidTestImplementation Deps.androidx_benchmark_junit4 - androidTestImplementation Deps.mockwebserver - testImplementation Deps.mozilla_support_test - testImplementation Deps.mozilla_support_test_libstate - testImplementation Deps.androidx_junit - testImplementation Deps.androidx_test_extensions - testImplementation Deps.androidx_work_testing - testImplementation (Deps.robolectric) { + androidTestImplementation libs.androidx.junit + androidTestImplementation libs.androidx.test.extensions + androidTestImplementation libs.androidx.work.testing + androidTestImplementation libs.androidx.benchmark.junit4 + androidTestImplementation libs.mockwebserver + androidTestImplementation libs.androidx.compose.ui.test + testImplementation libs.mozilla.support.test + testImplementation libs.mozilla.support.test.libstate + testImplementation libs.androidx.junit + testImplementation libs.androidx.test.extensions + testImplementation libs.androidx.work.testing + testImplementation (libs.robolectric) { exclude group: 'org.apache.maven' } testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3' - implementation Deps.mozilla_support_rusthttp + implementation libs.mozilla.support.rusthttp - testImplementation Deps.mockk + testImplementation libs.mockk lintChecks project(":mozilla-lint-rules") + + coreLibraryDesugaring libs.desugar } if (project.hasProperty("coverage")) { @@ -519,14 +556,6 @@ if (project.hasProperty("coverage")) { ])) } } - - android { - buildTypes { - debug { - testCoverageEnabled true - } - } - } } // ------------------------------------------------------------------------------------------------- diff --git a/app/src/androidTest/java/net/waterfox/android/screenshots/MenuScreenShotTest.kt b/app/src/androidTest/java/net/waterfox/android/screenshots/MenuScreenShotTest.kt index 7ceb03f..6e348bf 100644 --- a/app/src/androidTest/java/net/waterfox/android/screenshots/MenuScreenShotTest.kt +++ b/app/src/androidTest/java/net/waterfox/android/screenshots/MenuScreenShotTest.kt @@ -200,7 +200,7 @@ fun editBookmarkFolder() = onView(withText(R.string.bookmark_menu_edit_button)). fun deleteBookmarkFolder() = onView(withText(R.string.bookmark_menu_delete_button)).click() -fun tapOnTabCounter() = onView(withId(R.id.counter_text)).click() +fun tapOnTabCounter() = onView(withId(mozilla.components.ui.tabcounter.R.id.counter_text)).click() fun settingsAccountPreferences() = onView(withText(R.string.preferences_sync_2)).click() diff --git a/app/src/androidTest/java/net/waterfox/android/ui/BrowsingErrorPagesTest.kt b/app/src/androidTest/java/net/waterfox/android/ui/BrowsingErrorPagesTest.kt index 1497a41..bf001a8 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/BrowsingErrorPagesTest.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/BrowsingErrorPagesTest.kt @@ -21,11 +21,11 @@ import net.waterfox.android.ui.robots.navigationToolbar * Tests that verify errors encountered while browsing websites: unsafe pages, connection errors, etc */ class BrowsingErrorPagesTest { - private val malwareWarning = getStringResource(R.string.mozac_browser_errorpages_safe_browsing_malware_uri_title) - private val phishingWarning = getStringResource(R.string.mozac_browser_errorpages_safe_phishing_uri_title) + private val malwareWarning = getStringResource(mozilla.components.browser.errorpages.R.string.mozac_browser_errorpages_safe_browsing_malware_uri_title) + private val phishingWarning = getStringResource(mozilla.components.browser.errorpages.R.string.mozac_browser_errorpages_safe_phishing_uri_title) private val unwantedSoftwareWarning = - getStringResource(R.string.mozac_browser_errorpages_safe_browsing_unwanted_uri_title) - private val harmfulSiteWarning = getStringResource(R.string.mozac_browser_errorpages_safe_harmful_uri_title) + getStringResource(mozilla.components.browser.errorpages.R.string.mozac_browser_errorpages_safe_browsing_unwanted_uri_title) + private val harmfulSiteWarning = getStringResource(mozilla.components.browser.errorpages.R.string.mozac_browser_errorpages_safe_harmful_uri_title) private val featureSettingsHelper = FeatureSettingsHelper() @get: Rule diff --git a/app/src/androidTest/java/net/waterfox/android/ui/NoNetworkAccessStartupTests.kt b/app/src/androidTest/java/net/waterfox/android/ui/NoNetworkAccessStartupTests.kt index 631d14b..2f9fbaf 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/NoNetworkAccessStartupTests.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/NoNetworkAccessStartupTests.kt @@ -113,7 +113,7 @@ class NoNetworkAccessStartupTests { verifyUrl( "waterfox.net", "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view ) } } diff --git a/app/src/androidTest/java/net/waterfox/android/ui/ReaderViewTest.kt b/app/src/androidTest/java/net/waterfox/android/ui/ReaderViewTest.kt index 7620244..0c06c53 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/ReaderViewTest.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/ReaderViewTest.kt @@ -76,7 +76,7 @@ class ReaderViewTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityIntentTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) @@ -119,7 +119,7 @@ class ReaderViewTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityIntentTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) @@ -157,7 +157,7 @@ class ReaderViewTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityIntentTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) @@ -197,7 +197,7 @@ class ReaderViewTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityIntentTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) @@ -243,7 +243,7 @@ class ReaderViewTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityIntentTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/SmokeTest.kt b/app/src/androidTest/java/net/waterfox/android/ui/SmokeTest.kt index 8d6e461..aec0830 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/SmokeTest.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/SmokeTest.kt @@ -762,7 +762,7 @@ class SmokeTest { } readerViewNotification = ViewVisibilityIdlingResource( - activityTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), + activityTestRule.activity.findViewById(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions), View.VISIBLE ) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/BrowserRobot.kt index 79b864e..2a30c8b 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/BrowserRobot.kt @@ -971,7 +971,7 @@ fun browserScreen(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { fun navURLBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar")) -fun searchBar() = onView(withId(R.id.mozac_browser_toolbar_url_view)) +fun searchBar() = onView(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view)) fun homeScreenButton() = onView(withContentDescription(R.string.browser_toolbar_home)) @@ -985,7 +985,7 @@ private fun assertNavURLBar() = assertTrue(navURLBar().waitForExists(waitingTime private fun assertNavURLBarHidden() = assertTrue(navURLBar().waitUntilGone(waitingTime)) private fun assertSecureConnectionLockIcon() { - onView(withId(R.id.mozac_browser_toolbar_security_indicator)) + onView(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_site_info_indicator)) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/FindInPageRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/FindInPageRobot.kt index b1f7f8f..7513b93 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/FindInPageRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/FindInPageRobot.kt @@ -67,11 +67,11 @@ class FindInPageRobot { } } -private fun findInPageQuery() = onView(withId(R.id.find_in_page_query_text)) -private fun findInPageResult() = onView(withId(R.id.find_in_page_result_text)) -private fun findInPageNextButton() = onView(withId(R.id.find_in_page_next_btn)) -private fun findInPagePrevButton() = onView(withId(R.id.find_in_page_prev_btn)) -private fun findInPageCloseButton() = onView(withId(R.id.find_in_page_close_btn)) +private fun findInPageQuery() = onView(withId(mozilla.components.feature.findinpage.R.id.find_in_page_query_text)) +private fun findInPageResult() = onView(withId(mozilla.components.feature.findinpage.R.id.find_in_page_result_text)) +private fun findInPageNextButton() = onView(withId(mozilla.components.feature.findinpage.R.id.find_in_page_next_btn)) +private fun findInPagePrevButton() = onView(withId(mozilla.components.feature.findinpage.R.id.find_in_page_prev_btn)) +private fun findInPageCloseButton() = onView(withId(mozilla.components.feature.findinpage.R.id.find_in_page_close_btn)) private fun assertFindInPageQuery() = findInPageQuery() .check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/HomeScreenRobot.kt index 0e33c7f..b48dbf3 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/HomeScreenRobot.kt @@ -523,7 +523,7 @@ private fun assertHomeComponent() = onView(ViewMatchers.withResourceName("sessionControlRecyclerView")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) -private fun assertNoTabsOpened() = onView(withId(R.id.counter_text)).check(matches(withText("0"))) +private fun assertNoTabsOpened() = onView(withId(mozilla.components.ui.tabcounter.R.id.counter_text)).check(matches(withText("0"))) private fun threeDotButton() = onView(allOf(withId(R.id.menuButton))) @@ -778,7 +778,7 @@ private fun startBrowsingButton(): UiObject { val deleteFromHistory = onView( allOf( - withId(R.id.simple_text), + withId(mozilla.components.browser.menu2.R.id.simple_text), withText(R.string.delete_from_history) ) ).inRoot(RootMatchers.isPlatformPopup()) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/NavigationToolbarRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/NavigationToolbarRobot.kt index 4348a86..df9c409 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/NavigationToolbarRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/NavigationToolbarRobot.kt @@ -185,7 +185,7 @@ class NavigationToolbarRobot { fun closeTabFromShortcutsMenu(interact: NavigationToolbarRobot.() -> Unit): NavigationToolbarRobot.Transition { mDevice.waitForIdle(waitingTime) - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.actionOnItem( hasDescendant( @@ -202,7 +202,7 @@ class NavigationToolbarRobot { fun openTabFromShortcutsMenu(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { mDevice.waitForIdle(waitingTime) - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.actionOnItem( hasDescendant( @@ -219,7 +219,7 @@ class NavigationToolbarRobot { fun openNewPrivateTabFromShortcutsMenu(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { mDevice.waitForIdle(waitingTime) - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.actionOnItem( hasDescendant( @@ -271,7 +271,7 @@ private fun assertNoHistoryBookmarks() { } private fun assertTabButtonShortcutMenuItems() { - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .check(matches(hasDescendant(withText("Close tab")))) .check(matches(hasDescendant(withText("New private tab")))) .check(matches(hasDescendant(withText("New tab")))) @@ -280,14 +280,14 @@ private fun assertTabButtonShortcutMenuItems() { private fun urlBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar")) private fun awesomeBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view")) -private fun threeDotButton() = onView(withId(R.id.mozac_browser_toolbar_menu)) +private fun threeDotButton() = onView(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_menu)) private fun tabTrayButton() = onView(withId(R.id.tab_button)) private fun fillLinkButton() = onView(withId(R.id.fill_link_from_clipboard)) private fun clearAddressBar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_clear_view")) private fun goBackButton() = mDevice.pressBack() private fun readerViewToggle() = - onView(withParent(withId(R.id.mozac_browser_toolbar_page_actions))) + onView(withParent(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions))) private fun assertReaderViewDetected(visible: Boolean) { mDevice.findObject( @@ -298,7 +298,7 @@ private fun assertReaderViewDetected(visible: Boolean) { onView( allOf( - withParent(withId(R.id.mozac_browser_toolbar_page_actions)), + withParent(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions)), withContentDescription("Reader view") ) ).check( @@ -316,7 +316,7 @@ private fun assertCloseReaderViewDetected(visible: Boolean) { onView( allOf( - withParent(withId(R.id.mozac_browser_toolbar_page_actions)), + withParent(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_page_actions)), withContentDescription("Close reader view") ) ).check( diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/ReaderViewRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/ReaderViewRobot.kt index ea0927d..cdd98fe 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/ReaderViewRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/ReaderViewRobot.kt @@ -92,7 +92,7 @@ class ReaderViewRobot { fun toggleSansSerif(interact: ReaderViewRobot.() -> Unit): Transition { fun sansSerifButton() = onView( - withId(R.id.mozac_feature_readerview_font_sans_serif) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_sans_serif) ) sansSerifButton().click() @@ -104,7 +104,7 @@ class ReaderViewRobot { fun toggleSerif(interact: ReaderViewRobot.() -> Unit): Transition { fun serifButton() = onView( - withId(R.id.mozac_feature_readerview_font_serif) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_serif) ) serifButton().click() @@ -116,7 +116,7 @@ class ReaderViewRobot { fun toggleFontSizeDecrease(interact: ReaderViewRobot.() -> Unit): Transition { fun fontSizeDecrease() = onView( - withId(R.id.mozac_feature_readerview_font_size_decrease) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_decrease) ) fontSizeDecrease().click() @@ -128,7 +128,7 @@ class ReaderViewRobot { fun toggleFontSizeIncrease(interact: ReaderViewRobot.() -> Unit): Transition { fun fontSizeIncrease() = onView( - withId(R.id.mozac_feature_readerview_font_size_increase) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_increase) ) fontSizeIncrease().click() @@ -140,7 +140,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeLight(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleLightColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_light) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_light) ) toggleLightColorSchemeButton().click() @@ -152,7 +152,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeDark(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleDarkColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_dark) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_dark) ) toggleDarkColorSchemeButton().click() @@ -164,7 +164,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeSepia(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleSepiaColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_sepia) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_sepia) ) toggleSepiaColorSchemeButton().click() @@ -182,63 +182,63 @@ fun readerViewRobot(interact: ReaderViewRobot.() -> Unit): ReaderViewRobot.Trans private fun assertAppearanceFontGroup(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_group) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_group) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceFontSansSerif(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_sans_serif) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_sans_serif) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceFontSerif(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_serif) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_serif) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceFontDecrease(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_size_decrease) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_decrease) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceFontIncrease(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_size_increase) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_increase) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceColorDark(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_dark) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_dark) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceColorLight(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_light) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_light) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceColorSepia(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_sepia) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_sepia) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) private fun assertAppearanceColorGroup(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_scheme_group) + withId(mozilla.components.feature.readerview.R.id.mozac_feature_readerview_color_scheme_group) ).check( matches(withEffectiveVisibility(visibleOrGone(visible))) ) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/SearchRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/SearchRobot.kt index 6bc9b2e..c64c7c0 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/SearchRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/SearchRobot.kt @@ -392,7 +392,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean): () -> Unit } private fun ComposeTestRule.assertSearchEngineList() { - onView(withId(R.id.mozac_browser_toolbar_edit_icon)).click() + onView(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_edit_icon)).click() onNodeWithText("Google") .assertExists() @@ -445,7 +445,7 @@ private fun assertEngineListShortcutContains(rule: ComposeTestRule, searchEngine } private fun ComposeTestRule.selectDefaultSearchEngine(searchEngine: String) { - onView(withId(R.id.mozac_browser_toolbar_edit_icon)).click() + onView(withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_edit_icon)).click() onNodeWithText(searchEngine) .assertExists() @@ -470,7 +470,7 @@ private fun assertPastedToolbarText(expectedText: String) { onView( allOf( withSubstring(expectedText), - withId(R.id.mozac_browser_toolbar_edit_url_view) + withId(mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_edit_url_view) ) ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAboutRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAboutRobot.kt index b756fce..3cb7b5f 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAboutRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAboutRobot.kt @@ -131,7 +131,7 @@ private fun assertSupport(rule: ComposeTestRule) { TestHelper.verifyUrl( "waterfox.net/docs/support", "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view ) } @@ -165,7 +165,7 @@ private fun assertPrivacyNotice(rule: ComposeTestRule) { TestHelper.verifyUrl( "waterfox.net/docs/policies/privacy", "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view ) } @@ -180,7 +180,7 @@ private fun assertKnowYourRights(rule: ComposeTestRule) { TestHelper.verifyUrl( SupportUtils.SumoTopic.YOUR_RIGHTS.topicStr, "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view ) } @@ -195,7 +195,7 @@ private fun assertLicensingInformation(rule: ComposeTestRule) { TestHelper.verifyUrl( "about:license", "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + mozilla.components.browser.toolbar.R.id.mozac_browser_toolbar_url_view ) } diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAccessibilityRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAccessibilityRobot.kt index 51e6d43..61ecf62 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAccessibilityRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAccessibilityRobot.kt @@ -107,15 +107,15 @@ private fun assertSliderBar() { // onView(withId(net.waterfox.android.R.id.sampleText)) // .check(matches(withText("This is sample text. It is here to show how text will appear when you increase or decrease the size with this setting."))) - onView(withId(net.waterfox.android.R.id.seekbar_value)) + onView(withId(androidx.preference.R.id.seekbar_value)) .check(matches(withText("100%"))) - onView(withId(net.waterfox.android.R.id.seekbar)) + onView(withId(androidx.preference.R.id.seekbar)) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } private fun adjustTextSizeSlider(seekBarPercentage: Int) { - onView(withId(net.waterfox.android.R.id.seekbar)) + onView(withId(androidx.preference.R.id.seekbar)) .perform(SeekBarChangeProgressViewAction(seekBarPercentage)) } @@ -134,9 +134,9 @@ private fun assertMenuItemsAreDisabled() { // onView(withId(net.waterfox.android.R.id.sampleText)).assertIsEnabled(false) - onView(withId(net.waterfox.android.R.id.seekbar_value)).assertIsEnabled(false) + onView(withId(androidx.preference.R.id.seekbar_value)).assertIsEnabled(false) - onView(withId(net.waterfox.android.R.id.seekbar)).assertIsEnabled(false) + onView(withId(androidx.preference.R.id.seekbar)).assertIsEnabled(false) } private fun goBackButton() = diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAddonsManagerRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAddonsManagerRobot.kt index 41d4cca..215bbfe 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAddonsManagerRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/SettingsSubMenuAddonsManagerRobot.kt @@ -124,7 +124,7 @@ class SettingsSubMenuAddonsManagerRobot { mDevice.findObject(UiSelector().text("Allow in private browsing")) .waitForExists(waitingTimeLong) ) - onView(withId(R.id.allow_in_private_browsing)).click() + onView(withId(mozilla.components.feature.addons.R.id.allow_in_private_browsing)).click() } fun installAddon(addonName: String) { @@ -154,10 +154,10 @@ class SettingsSubMenuAddonsManagerRobot { onView( allOf( - withId(R.id.add_on_item), + withId(mozilla.components.feature.addons.R.id.add_on_item), hasDescendant( allOf( - withId(R.id.add_on_name), + withId(mozilla.components.feature.addons.R.id.add_on_name), withText(addonName) ) ) @@ -173,8 +173,8 @@ class SettingsSubMenuAddonsManagerRobot { private fun installButtonForAddon(addonName: String) = onView( allOf( - withContentDescription(R.string.mozac_feature_addons_install_addon_content_description_2), - isDescendantOfA(withId(R.id.add_on_item)), + withContentDescription(mozilla.components.feature.addons.R.string.mozac_feature_addons_install_addon_content_description_2), + isDescendantOfA(withId(mozilla.components.feature.addons.R.id.add_on_item)), hasSibling(hasDescendant(withText(addonName))) ) ) @@ -196,10 +196,10 @@ class SettingsSubMenuAddonsManagerRobot { ) .check(matches(isCompletelyDisplayed())) - onView(allOf(withId(R.id.allow_button), withText("Add"))) + onView(allOf(withId(mozilla.components.feature.sitepermissions.R.id.allow_button), withText("Add"))) .check(matches(isCompletelyDisplayed())) - onView(allOf(withId(R.id.deny_button), withText("Cancel"))) + onView(allOf(withId(mozilla.components.feature.downloads.R.id.deny_button), withText("Cancel"))) .check(matches(isCompletelyDisplayed())) } @@ -207,20 +207,20 @@ class SettingsSubMenuAddonsManagerRobot { onView( allOf( withId(R.id.add_button), - isDescendantOfA(withId(R.id.add_on_item)), + isDescendantOfA(withId(mozilla.components.feature.addons.R.id.add_on_item)), hasSibling(hasDescendant(withText(addonName))) ) ).check(matches(withEffectiveVisibility(Visibility.GONE))) } private fun cancelInstall() { - onView(allOf(withId(R.id.deny_button), withText("Cancel"))) + onView(allOf(withId(mozilla.components.feature.downloads.R.id.deny_button), withText("Cancel"))) .check(matches(isCompletelyDisplayed())) .perform(click()) } private fun allowPermissionToInstall() { - onView(allOf(withId(R.id.allow_button), withText("Add"))) + onView(allOf(withId(mozilla.components.feature.sitepermissions.R.id.allow_button), withText("Add"))) .check(matches(isCompletelyDisplayed())) .perform(click()) } @@ -243,11 +243,11 @@ class SettingsSubMenuAddonsManagerRobot { onView( allOf( isAssignableFrom(RelativeLayout::class.java), - withId(R.id.add_on_item), - hasDescendant(allOf(withId(R.id.add_on_icon), isCompletelyDisplayed())), + withId(mozilla.components.feature.addons.R.id.add_on_item), + hasDescendant(allOf(withId(mozilla.components.feature.addons.R.id.add_on_icon), isCompletelyDisplayed())), hasDescendant( allOf( - withId(R.id.details_container), + withId(mozilla.components.feature.addons.R.id.details_container), hasDescendant(withText("uBlock Origin")), hasDescendant(withText("Finally, an efficient wide-spectrum content blocker. Easy on CPU and memory.")), hasDescendant(withId(R.id.rating)), @@ -269,7 +269,7 @@ class SettingsSubMenuAddonsManagerRobot { hasSibling( hasDescendant( allOf( - withId(R.id.add_on_name), + withId(mozilla.components.feature.addons.R.id.add_on_name), withText(addonName) ) ) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/SitePermissionsRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/SitePermissionsRobot.kt index 9775019..ca803af 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/SitePermissionsRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/SitePermissionsRobot.kt @@ -83,7 +83,7 @@ class SitePermissionsRobot { } fun selectRememberPermissionDecision() { - onView(withId(R.id.do_not_ask_again)) + onView(withId(mozilla.components.feature.sitepermissions.R.id.do_not_ask_again)) .check(matches(isDisplayed())) .click() } diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/TabDrawerRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/TabDrawerRobot.kt index 0addcca..266a42a 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/TabDrawerRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/TabDrawerRobot.kt @@ -613,12 +613,12 @@ private fun tabItem(title: String) = private fun tabsCounter() = onView(withId(R.id.tab_button)) -private fun tabsTrayCounterBox() = onView(withId(R.id.counter_box)) +private fun tabsTrayCounterBox() = onView(withId(mozilla.components.ui.tabcounter.R.id.counter_box)) private fun tabsSettingsButton() = onView( allOf( - withId(R.id.simple_text), + withId(mozilla.components.browser.menu2.R.id.simple_text), withText(R.string.tab_tray_menu_tab_settings) ) ) @@ -626,7 +626,7 @@ private fun tabsSettingsButton() = private fun recentlyClosedTabsButton() = onView( allOf( - withId(R.id.simple_text), + withId(mozilla.components.browser.menu2.R.id.simple_text), withText(R.string.tab_tray_menu_recently_closed) ) ) diff --git a/app/src/androidTest/java/net/waterfox/android/ui/robots/ThreeDotMenuMainRobot.kt b/app/src/androidTest/java/net/waterfox/android/ui/robots/ThreeDotMenuMainRobot.kt index aeb45d1..9e767d8 100644 --- a/app/src/androidTest/java/net/waterfox/android/ui/robots/ThreeDotMenuMainRobot.kt +++ b/app/src/androidTest/java/net/waterfox/android/ui/robots/ThreeDotMenuMainRobot.kt @@ -61,7 +61,7 @@ class ThreeDotMenuMainRobot { fun verifyReaderViewAppearance(visible: Boolean) = assertReaderViewAppearanceButton(visible) fun expandMenu() { - onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeUp()) + onView(withId(mozilla.components.browser.menu.R.id.mozac_browser_menu_menuView)).perform(swipeUp()) } fun verifyShareTabButton() = assertShareTabButton() @@ -399,7 +399,7 @@ class ThreeDotMenuMainRobot { } } private fun threeDotMenuRecyclerView() = - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) private fun threeDotMenuRecyclerViewExists() { threeDotMenuRecyclerView().check(matches(isDisplayed())) @@ -421,7 +421,7 @@ private fun assertCustomizeHomeButton() = private fun addOnsButton() = onView(allOf(withText("Add-ons"))) private fun assertAddOnsButton() { - onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown()) + onView(withId(mozilla.components.browser.menu.R.id.mozac_browser_menu_menuView)).perform(swipeDown()) addOnsButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -447,7 +447,7 @@ private fun backButton() = mDevice.findObject(UiSelector().description("Back")) private fun addBookmarkButton() = onView(allOf(withId(R.id.checkbox), withText("Add"))) private fun assertAddBookmarkButton() { - onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeUp()) + onView(withId(mozilla.components.browser.menu.R.id.mozac_browser_menu_menuView)).perform(swipeUp()) addBookmarkButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -525,7 +525,7 @@ private fun removeFromShortcutsButton() = onView(allOf(withText(R.string.browser_menu_remove_from_shortcuts))) private fun assertAddToTopSitesButton() { - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( hasDescendant(withText(R.string.browser_menu_add_to_shortcuts)) @@ -535,7 +535,7 @@ private fun assertAddToTopSitesButton() { private fun assertRemoveFromShortcutsButton() { - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( hasDescendant(withText(R.string.browser_menu_settings)) @@ -547,7 +547,7 @@ private fun addToMobileHomeButton() = onView(allOf(withText(R.string.browser_menu_add_to_homescreen))) private fun assertAddToMobileHome() { - onView(withId(R.id.mozac_browser_menu_recyclerView)) + onView(withId(mozilla.components.browser.menu2.R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( hasDescendant(withText(R.string.browser_menu_add_to_homescreen)) @@ -573,12 +573,12 @@ private fun openInAppButton() = private fun downloadsButton() = onView(withText(R.string.library_downloads)) private fun assertDownloadsButton() { - onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown()) + onView(withId(mozilla.components.browser.menu.R.id.mozac_browser_menu_menuView)).perform(swipeDown()) downloadsButton().check(matches(isDisplayed())) } private fun clickAddonsManagerButton() { - onView(withId(R.id.mozac_browser_menu_menuView)).perform(swipeDown()) + onView(withId(mozilla.components.browser.menu.R.id.mozac_browser_menu_menuView)).perform(swipeDown()) addOnsButton().check(matches(isCompletelyDisplayed())).click() } diff --git a/app/src/debug/res/values/colors.xml b/app/src/debug/res/values/colors.xml index 31d64e9..df565a8 100644 --- a/app/src/debug/res/values/colors.xml +++ b/app/src/debug/res/values/colors.xml @@ -3,5 +3,5 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - @color/photonInk20 + #FFFFFF diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ebe6d7c..6c9b687 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -44,7 +44,6 @@ + + + + + + + + + = Build.VERSION_CODES.R) { + window.setDecorFitsSystemWindows(false) + // Ensure navigation bar color matches theme + window.navigationBarColor = getColorFromAttr(R.attr.layer1) + } else + @Suppress("DEPRECATION") + window.decorView.systemUiVisibility = ( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE or + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + ) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + window.navigationBarColor = getColorFromAttr(R.attr.layer1) + } + ProfilerMarkers.addListenerForOnGlobalLayout(components.core.engine, this, binding.root) // Must be after we set the content view diff --git a/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt b/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt index 18f7d65..e19af8d 100644 --- a/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt +++ b/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt @@ -17,8 +17,8 @@ import androidx.core.content.getSystemService import androidx.lifecycle.ProcessLifecycleOwner import androidx.work.Configuration.Builder import androidx.work.Configuration.Provider -import coil.Coil -import coil.ImageLoader +import coil3.SingletonImageLoader +import coil3.ImageLoader import kotlinx.coroutines.* import mozilla.appservices.Megazord import mozilla.components.browser.state.action.SystemAction @@ -62,6 +62,8 @@ import net.waterfox.android.session.VisibilityLifecycleCallback import net.waterfox.android.utils.BrowsersCache import net.waterfox.android.utils.Settings.Companion.TOP_SITES_PROVIDER_MAX_THRESHOLD import java.util.concurrent.TimeUnit +import mozilla.appservices.init_rust_components.initialize as InitializeRustComponents + /** *The main application class for Waterfox. Records data to measure initialization performance. @@ -115,11 +117,10 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider { ProfilerMarkerFactProcessor.create { components.core.engine.profiler }.register() // This is a workaround for https://github.com/coil-kt/coil/issues/383 - Coil.setImageLoader( - ImageLoader.Builder(this) - .addLastModifiedToFileCacheKey(false) + SingletonImageLoader.setSafe { + ImageLoader.Builder(this@WaterfoxApplication) .build() - ) + } run { // Make sure the engine is initialized and ready to use. @@ -136,7 +137,7 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider { val megazordSetup = finishSetupMegazord() setDayNightTheme() - components.strictMode.enableStrictMode(true) + //components.strictMode.enableStrictMode(true) warmBrowsersCache() initializeWebExtensionSupport() @@ -160,7 +161,7 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider { } setupLeakCanary() - + setupPush() visibilityLifecycleCallback = VisibilityLifecycleCallback(getSystemService()) registerActivityLifecycleCallbacks(visibilityLifecycleCallback) @@ -292,7 +293,25 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider { // no-op, LeakCanary is disabled by default } + private fun setupPush() { + // Sets the PushFeature as the singleton instance for push messages to go to. + // We need the push feature setup here to deliver messages in the case where the service + // starts up the app first. + components.push.feature?.let { + Logger.info("AutoPushFeature is configured, initializing it...") + // Install the AutoPush singleton to receive messages. + PushProcessor.install(it) + + WebPushEngineIntegration(components.core.engine, it).start() + + // Perform a one-time initialization of the account manager if a message is received. + PushFxaIntegration(it, lazy { components.backgroundServices.accountManager }).launch() + + // Initialize the service. This could potentially be done in a coroutine in the future. + it.initialize() + } + } private fun setupCrashReporting() { components.analytics.crashReporter.install(this) @@ -313,6 +332,9 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider { * thread, early in the app startup sequence. */ private fun beginSetupMegazord() { + // Rust components must be initialized at the very beginning, before any other Rust call, ... + InitializeRustComponents() + // Note: Megazord.init() must be called as soon as possible ... Megazord.init() diff --git a/app/src/main/java/net/waterfox/android/addons/AddonDetailsBindingDelegate.kt b/app/src/main/java/net/waterfox/android/addons/AddonDetailsBindingDelegate.kt index d6cfb57..ab96781 100644 --- a/app/src/main/java/net/waterfox/android/addons/AddonDetailsBindingDelegate.kt +++ b/app/src/main/java/net/waterfox/android/addons/AddonDetailsBindingDelegate.kt @@ -65,11 +65,11 @@ class AddonDetailsBindingDelegate( addon.rating?.let { rating -> val resources = binding.root.resources val ratingContentDescription = - resources.getString(R.string.mozac_feature_addons_rating_content_description_2) + resources.getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_rating_content_description_2) binding.ratingLabel.contentDescription = String.format(ratingContentDescription, rating.average) binding.ratingView.rating = rating.average - val reviewCount = resources.getString(R.string.mozac_feature_addons_user_rating_count_2) + val reviewCount = resources.getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_user_rating_count_2) binding.reviewCount.contentDescription = String.format(reviewCount, numberFormatter.format(rating.reviews)) binding.reviewCount.text = numberFormatter.format(rating.reviews) diff --git a/app/src/main/java/net/waterfox/android/addons/AddonsManagementFragment.kt b/app/src/main/java/net/waterfox/android/addons/AddonsManagementFragment.kt index 0e9be9d..dbc48f7 100644 --- a/app/src/main/java/net/waterfox/android/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/net/waterfox/android/addons/AddonsManagementFragment.kt @@ -119,7 +119,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) binding?.let { showSnackBar( it.root, - getString(R.string.mozac_feature_addons_failed_to_query_extensions), + getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_query_extensions), ) } binding?.addOnsProgressBar?.isVisible = false diff --git a/app/src/main/java/net/waterfox/android/addons/InstalledAddonDetailsFragment.kt b/app/src/main/java/net/waterfox/android/addons/InstalledAddonDetailsFragment.kt index bf2bdd3..a674e8b 100644 --- a/app/src/main/java/net/waterfox/android/addons/InstalledAddonDetailsFragment.kt +++ b/app/src/main/java/net/waterfox/android/addons/InstalledAddonDetailsFragment.kt @@ -130,7 +130,7 @@ class InstalledAddonDetailsFragment : Fragment() { runIfFragmentIsAttached { showSnackBar( binding.root, - getString(R.string.mozac_feature_addons_failed_to_query_extensions), + getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_query_extensions), ) findNavController().popBackStack() } @@ -189,7 +189,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_successfully_enabled, + mozilla.components.feature.addons.R.string.mozac_feature_addons_successfully_enabled, addon.translateName(it), ), ) @@ -205,7 +205,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_failed_to_enable, + mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_enable, addon.translateName(it), ), ) @@ -227,7 +227,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_successfully_disabled, + mozilla.components.feature.addons.R.string.mozac_feature_addons_successfully_disabled, addon.translateName(it), ), ) @@ -243,7 +243,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_failed_to_disable, + mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_disable, addon.translateName(it), ), ) @@ -285,7 +285,7 @@ class InstalledAddonDetailsFragment : Fragment() { if (addon.incognito == Addon.Incognito.NOT_ALLOWED) { switch.isChecked = false switch.isEnabled = false - switch.text = requireContext().getString(R.string.mozac_feature_addons_not_allowed_in_private_browsing) + switch.text = requireContext().getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_not_allowed_in_private_browsing) return } @@ -392,7 +392,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_successfully_uninstalled, + mozilla.components.feature.addons.R.string.mozac_feature_addons_successfully_uninstalled, addon.translateName(it), ), ) @@ -407,7 +407,7 @@ class InstalledAddonDetailsFragment : Fragment() { showSnackBar( binding.root, getString( - R.string.mozac_feature_addons_failed_to_uninstall, + mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_uninstall, addon.translateName(it), ), ) diff --git a/app/src/main/java/net/waterfox/android/addons/NotYetSupportedAddonFragment.kt b/app/src/main/java/net/waterfox/android/addons/NotYetSupportedAddonFragment.kt index 88219af..c209cca 100644 --- a/app/src/main/java/net/waterfox/android/addons/NotYetSupportedAddonFragment.kt +++ b/app/src/main/java/net/waterfox/android/addons/NotYetSupportedAddonFragment.kt @@ -55,12 +55,12 @@ class NotYetSupportedAddonFragment : override fun onResume() { super.onResume() - showToolbar(getString(R.string.mozac_feature_addons_unavailable_section)) + showToolbar(getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_unavailable_section)) } override fun onUninstallError(addonId: String, throwable: Throwable) { this@NotYetSupportedAddonFragment.view?.let { view -> - showSnackBar(view, getString(R.string.mozac_feature_addons_failed_to_remove, "")) + showSnackBar(view, getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_failed_to_remove, "")) } if (unsupportedAddonsAdapter?.itemCount == 0) { @@ -70,7 +70,7 @@ class NotYetSupportedAddonFragment : override fun onUninstallSuccess() { this@NotYetSupportedAddonFragment.view?.let { view -> - showSnackBar(view, getString(R.string.mozac_feature_addons_successfully_removed, "")) + showSnackBar(view, getString(mozilla.components.feature.addons.R.string.mozac_feature_addons_successfully_removed, "")) } } } diff --git a/app/src/main/java/net/waterfox/android/browser/BaseBrowserFragment.kt b/app/src/main/java/net/waterfox/android/browser/BaseBrowserFragment.kt index a1a2782..28f6b58 100644 --- a/app/src/main/java/net/waterfox/android/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/net/waterfox/android/browser/BaseBrowserFragment.kt @@ -416,7 +416,7 @@ abstract class BaseBrowserFragment : view = view ) - browserToolbarView.view.display.setOnSiteSecurityClickedListener { + browserToolbarView.view.display.setOnSiteInfoClickedListener { showQuickSettingsDialog() } @@ -720,7 +720,7 @@ abstract class BaseBrowserFragment : gravity = getAppropriateLayoutGravity(), shouldWidthMatchParent = true, positiveButtonBackgroundColor = accentHighContrastColor, - positiveButtonTextColor = R.color.photonWhite + positiveButtonTextColor = mozilla.components.ui.colors.R.color.photonWhite ), sessionId = customTabSessionId, onNeedToRequestPermissions = { permissions -> diff --git a/app/src/main/java/net/waterfox/android/browser/BrowserFragment.kt b/app/src/main/java/net/waterfox/android/browser/BrowserFragment.kt index 6f822f4..5bf74c8 100644 --- a/app/src/main/java/net/waterfox/android/browser/BrowserFragment.kt +++ b/app/src/main/java/net/waterfox/android/browser/BrowserFragment.kt @@ -69,7 +69,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { val homeAction = BrowserToolbar.Button( imageDrawable = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_home_24 + mozilla.components.ui.icons.R.drawable.mozac_ic_home_24 )!!, contentDescription = context.getString(R.string.browser_toolbar_home), iconTintColorResource = ThemeManager.resolveAttribute(R.attr.textPrimary, context), @@ -84,7 +84,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { val backAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_back_24 + mozilla.components.ui.icons.R.drawable.mozac_ic_back_24 )!!, primaryContentDescription = context.getString(R.string.browser_menu_back), primaryImageTintResource = enableTint, @@ -106,7 +106,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { val forwardAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_forward_24 + mozilla.components.ui.icons.R.drawable.mozac_ic_forward_24 )!!, primaryContentDescription = context.getString(R.string.browser_menu_forward), primaryImageTintResource = enableTint, @@ -128,7 +128,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { val refreshAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_arrow_clockwise_24 + mozilla.components.ui.icons.R.drawable.mozac_ic_arrow_clockwise_24 )!!, primaryContentDescription = context.getString(R.string.browser_menu_refresh), primaryImageTintResource = enableTint, @@ -137,7 +137,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { }, secondaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_stop + mozilla.components.ui.icons.R.drawable.mozac_ic_stop )!!, secondaryContentDescription = context.getString(R.string.browser_menu_stop), disableInSecondaryState = false, diff --git a/app/src/main/java/net/waterfox/android/browser/TabPreview.kt b/app/src/main/java/net/waterfox/android/browser/TabPreview.kt index 4a06802..eb188fc 100644 --- a/app/src/main/java/net/waterfox/android/browser/TabPreview.kt +++ b/app/src/main/java/net/waterfox/android/browser/TabPreview.kt @@ -44,8 +44,8 @@ class TabPreview @JvmOverloads constructor( } // Change view properties to avoid confusing the UI tests - binding.tabButton.findViewById(R.id.counter_box).id = View.NO_ID - binding.tabButton.findViewById(R.id.counter_text).id = View.NO_ID + binding.tabButton.findViewById(mozilla.components.ui.tabcounter.R.id.counter_box).id = View.NO_ID + binding.tabButton.findViewById(mozilla.components.ui.tabcounter.R.id.counter_text).id = View.NO_ID } override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { diff --git a/app/src/main/java/net/waterfox/android/browser/infobanner/DynamicInfoBannerBehavior.kt b/app/src/main/java/net/waterfox/android/browser/infobanner/DynamicInfoBannerBehavior.kt index 4d0d261..c1e43e5 100644 --- a/app/src/main/java/net/waterfox/android/browser/infobanner/DynamicInfoBannerBehavior.kt +++ b/app/src/main/java/net/waterfox/android/browser/infobanner/DynamicInfoBannerBehavior.kt @@ -21,7 +21,7 @@ import mozilla.components.browser.toolbar.BrowserToolbar * - immediately below the toolbar (toolbar fully expanded). */ class DynamicInfoBannerBehavior( - context: Context?, + context: Context, attrs: AttributeSet? ) : CoordinatorLayout.Behavior(context, attrs) { @VisibleForTesting diff --git a/app/src/main/java/net/waterfox/android/browser/readermode/ReaderModeController.kt b/app/src/main/java/net/waterfox/android/browser/readermode/ReaderModeController.kt index f497b7d..989a22e 100644 --- a/app/src/main/java/net/waterfox/android/browser/readermode/ReaderModeController.kt +++ b/app/src/main/java/net/waterfox/android/browser/readermode/ReaderModeController.kt @@ -67,8 +67,8 @@ class DefaultReaderModeController( private fun themeReaderViewControlsForPrivateMode(view: View) = with(view) { listOf( - R.id.mozac_feature_readerview_font_size_decrease, - R.id.mozac_feature_readerview_font_size_increase, + mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_decrease, + mozilla.components.feature.readerview.R.id.mozac_feature_readerview_font_size_increase, ).map { findViewById