LeOSium-WF/waterfoxPatches/0001-removing-firebase.patch

248 lines
11 KiB
Diff
Raw Permalink Normal View History

2024-12-12 08:45:34 +01:00
From 60fb8028e29b06689ad368ee67f03568278a1ff6 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
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" />
</service>
- <service
- android:name=".push.FirebasePushService"
- android:exported="false">
- <intent-filter>
- <action android:name="com.google.firebase.MESSAGING_EVENT" />
- </intent-filter>
- </service>
-
- <meta-data
- android:name="firebase_messaging_auto_init_enabled"
- android:value="true" />
- <meta-data
- android:name="firebase_analytics_collection_enabled"
- android:value="false" />
- <meta-data
- android:name="firebase_analytics_collection_deactivated"
- android:value="true" />
<!-- Removes the default Workmanager initialization so that we can use on-demand initializer. -->
<provider
android:name="androidx.startup.InitializationProvider"
diff --git a/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt b/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt
index 35306e584..18f7d656a 100644
--- a/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt
+++ b/app/src/main/java/net/waterfox/android/WaterfoxApplication.kt
@@ -160,7 +160,7 @@ open class WaterfoxApplication : LocaleAwareApplication(), Provider {
}
setupLeakCanary()
- setupPush()
+
visibilityLifecycleCallback = VisibilityLifecycleCallback(getSystemService())
registerActivityLifecycleCallbacks(visibilityLifecycleCallback)
@@ -292,25 +292,7 @@ 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)
diff --git a/app/src/main/java/net/waterfox/android/components/BackgroundServices.kt b/app/src/main/java/net/waterfox/android/components/BackgroundServices.kt
index 044965fde..5f581c3e6 100644
--- a/app/src/main/java/net/waterfox/android/components/BackgroundServices.kt
+++ b/app/src/main/java/net/waterfox/android/components/BackgroundServices.kt
@@ -58,7 +58,7 @@ private val DEFAULT_SYNCED_TABS_COMMANDS_EXTRA_FLUSH_DELAY = 5.seconds
@Suppress("LongParameterList")
class BackgroundServices(
private val context: Context,
- private val push: Push,
+
crashReporter: CrashReporter,
historyStorage: Lazy<PlacesHistoryStorage>,
bookmarkStorage: Lazy<PlacesBookmarksStorage>,
@@ -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