From 60fb8028e29b06689ad368ee67f03568278a1ff6 Mon Sep 17 00:00:00 2001 From: harvey186 Date: Wed, 11 Dec 2024 11:33:04 +0100 Subject: [PATCH] removing firebase --- app/build.gradle | 1 - app/src/main/AndroidManifest.xml | 17 ------- .../waterfox/android/WaterfoxApplication.kt | 20 +------- .../android/components/BackgroundServices.kt | 6 +-- .../waterfox/android/components/Components.kt | 3 +- .../net/waterfox/android/components/Push.kt | 47 ------------------- .../android/push/FirebasePushService.kt | 4 +- .../android/push/PushFxaIntegration.kt | 2 +- buildSrc/src/main/java/Dependencies.kt | 3 +- 9 files changed, 7 insertions(+), 96 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 218597cba..bd96af0df 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -402,7 +402,6 @@ dependencies { implementation Deps.mozilla_lib_crash implementation Deps.lib_crash_sentry - implementation Deps.mozilla_lib_push_firebase implementation Deps.mozilla_lib_state implementation Deps.mozilla_lib_dataprotect debugImplementation Deps.leakcanary diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 00e0fc785..4eb1bcc7c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -333,23 +333,6 @@ android:value="This foreground service allows users to easily remove private tabs from the notification" /> - - - - - - - - - , bookmarkStorage: Lazy, @@ -189,9 +189,7 @@ class BackgroundServices( accountManager.register(AccountManagerReadyObserver(accountManagerAvailableQueue)) // Enable push if it's configured. - push.feature?.let { autoPushFeature -> - FxaPushSupportFeature(context, accountManager, autoPushFeature, crashReporter) - } + SendTabFeature(accountManager) { device, tabs -> notificationManager.showReceivedTabs(context, device, tabs) diff --git a/app/src/main/java/net/waterfox/android/components/Components.kt b/app/src/main/java/net/waterfox/android/components/Components.kt index 75fec8e8c..c45081b3f 100644 --- a/app/src/main/java/net/waterfox/android/components/Components.kt +++ b/app/src/main/java/net/waterfox/android/components/Components.kt @@ -60,7 +60,6 @@ class Components(private val context: Context) { val backgroundServices by lazyMonitored { BackgroundServices( context, - push, analytics.crashReporter, core.lazyHistoryStorage, core.lazyBookmarksStorage, @@ -156,7 +155,7 @@ class Components(private val context: Context) { val publicSuffixList by lazyMonitored { PublicSuffixList(context) } val clipboardHandler by lazyMonitored { ClipboardHandler(context) } val performance by lazyMonitored { PerformanceComponent() } - val push by lazyMonitored { Push(context, analytics.crashReporter) } + val wifiConnectionMonitor by lazyMonitored { WifiConnectionMonitor(context as Application) } val strictMode by lazyMonitored { StrictModeManager(Config, this) } diff --git a/app/src/main/java/net/waterfox/android/components/Push.kt b/app/src/main/java/net/waterfox/android/components/Push.kt index ec9057c6b..e69de29bb 100644 --- a/app/src/main/java/net/waterfox/android/components/Push.kt +++ b/app/src/main/java/net/waterfox/android/components/Push.kt @@ -1,47 +0,0 @@ -/* 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/. */ - -package net.waterfox.android.components - -import android.content.Context -import mozilla.components.feature.push.AutoPushFeature -import mozilla.components.feature.push.PushConfig -import mozilla.components.lib.crash.CrashReporter -import mozilla.components.support.base.log.logger.Logger -import net.waterfox.android.R -import net.waterfox.android.perf.lazyMonitored -import net.waterfox.android.push.FirebasePushService - -/** - * Component group for push services. These components use services that strongly depend on - * push messaging (e.g. WebPush, SendTab). - */ -class Push(context: Context, crashReporter: CrashReporter) { - val feature by lazyMonitored { - pushConfig?.let { config -> - AutoPushFeature( - context = context, - service = pushService, - config = config, - crashReporter = crashReporter - ) - } - } - - private val pushConfig: PushConfig? by lazyMonitored { - val logger = Logger("PushConfig") - val projectIdKey = context.getString(R.string.pref_key_push_project_id) - val resId = context.resources.getIdentifier(projectIdKey, "string", context.packageName) - if (resId == 0) { - logger.warn("No firebase configuration found; cannot support push service.") - return@lazyMonitored null - } - - logger.debug("Creating push configuration for autopush.") - val projectId = context.resources.getString(resId) - PushConfig(projectId) - } - - private val pushService by lazyMonitored { FirebasePushService() } -} diff --git a/app/src/main/java/net/waterfox/android/push/FirebasePushService.kt b/app/src/main/java/net/waterfox/android/push/FirebasePushService.kt index 542fb26fe..e65df2085 100644 --- a/app/src/main/java/net/waterfox/android/push/FirebasePushService.kt +++ b/app/src/main/java/net/waterfox/android/push/FirebasePushService.kt @@ -6,11 +6,9 @@ package net.waterfox.android.push import android.annotation.SuppressLint import mozilla.components.feature.push.AutoPushFeature -import mozilla.components.lib.push.firebase.AbstractFirebasePushService /** * A singleton instance of the FirebasePushService needed for communicating between FCM and the * [AutoPushFeature]. */ -@SuppressLint("MissingFirebaseInstanceTokenRefresh") // Implemented internally. -class FirebasePushService : AbstractFirebasePushService() + diff --git a/app/src/main/java/net/waterfox/android/push/PushFxaIntegration.kt b/app/src/main/java/net/waterfox/android/push/PushFxaIntegration.kt index f527790ac..5c130f4c6 100644 --- a/app/src/main/java/net/waterfox/android/push/PushFxaIntegration.kt +++ b/app/src/main/java/net/waterfox/android/push/PushFxaIntegration.kt @@ -18,7 +18,7 @@ import mozilla.components.feature.push.PushScope import mozilla.components.service.fxa.manager.FxaAccountManager import mozilla.components.service.fxa.manager.ext.withConstellation import net.waterfox.android.components.BackgroundServices -import net.waterfox.android.components.Push + /** * A lazy initializer for FxaAccountManager if it isn't already initialized. diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 2973e0805..f349c13a3 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -8,7 +8,7 @@ object Versions { // This has to be synced to the gradlew plugin version. See // http://googlesamples.github.io/android-custom-lint-rules/api-guide/example.md.html#example:samplelintcheckgithubproject/lintversion? - const val android_gradle_plugin = "8.7.2" + const val android_gradle_plugin = "8.6.0" const val android_lint_api = "31.7.2" const val sentry = "7.9.0" @@ -146,7 +146,6 @@ object Deps { const val mozilla_lib_crash = "org.mozilla.components:lib-crash:${Versions.mozilla_android_components}" const val lib_crash_sentry = "org.mozilla.components:lib-crash-sentry:${Versions.mozilla_android_components}" - const val mozilla_lib_push_firebase = "org.mozilla.components:lib-push-firebase:${Versions.mozilla_android_components}" const val mozilla_lib_dataprotect = "org.mozilla.components:lib-dataprotect:${Versions.mozilla_android_components}" const val mozilla_lib_state = "org.mozilla.components:lib-state:${Versions.mozilla_android_components}" -- 2.34.1