From bfb2beabe7f508946165ab45e506fcd3d40cf3bf Mon Sep 17 00:00:00 2001 From: Jeff Boek Date: Tue, 27 Aug 2019 13:12:29 -0700 Subject: [PATCH] For #4063 - Always enable the push service (#4932) --- app/src/main/java/org/mozilla/fenix/FenixApplication.kt | 9 +++++++++ .../org/mozilla/fenix/components/BackgroundServices.kt | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 1772ed25c..4d32d693c 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -66,6 +66,8 @@ open class FenixApplication : Application() { return } + setupPush() + // Make sure the engine is initialized and ready to use. components.core.engine.warmUp() @@ -181,6 +183,13 @@ open class FenixApplication : Application() { } } + private fun setupPush() { + components + .backgroundServices + .push + .initialize() + } + private fun setupCrashReporting() { components .analytics diff --git a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt index f9cbe3ced..f6e95b3e2 100644 --- a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt +++ b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt @@ -137,8 +137,6 @@ class BackgroundServices( */ private val accountObserver = object : AccountObserver { override fun onLoggedOut() { - pushService.stop() - push.unsubscribeForType(PushType.Services) context.components.analytics.metrics.track(Event.SyncAuthSignOut) @@ -147,8 +145,6 @@ class BackgroundServices( } override fun onAuthenticated(account: OAuthAccount, newAccount: Boolean) { - pushService.start(context) - if (newAccount) { context.components.analytics.metrics.track(Event.FXANewSignup) push.subscribeForType(PushType.Services)