2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-09 19:10:42 +00:00

No Issue: Move notification manager to member of background services

Instead of taking notification manager as a parameter
(from the utils class), create one private to the
BackgroundServices class. This means that we do not need
to create the entirety of utilities just to use
the notification manager.
This commit is contained in:
Will Hawkins 2019-07-31 18:30:43 -04:00 committed by Jeff Boek
parent fa8199f429
commit ed31d990a4
3 changed files with 9 additions and 10 deletions

View File

@ -48,8 +48,7 @@ import org.mozilla.fenix.test.Mockable
class BackgroundServices( class BackgroundServices(
context: Context, context: Context,
historyStorage: PlacesHistoryStorage, historyStorage: PlacesHistoryStorage,
bookmarkStorage: PlacesBookmarksStorage, bookmarkStorage: PlacesBookmarksStorage
notificationManager: NotificationManager
) { ) {
companion object { companion object {
const val CLIENT_ID = "a2270f727f45f648" const val CLIENT_ID = "a2270f727f45f648"
@ -234,4 +233,11 @@ class BackgroundServices(
} }
CoroutineScope(Dispatchers.Main).launch { it.initAsync().await() } CoroutineScope(Dispatchers.Main).launch { it.initAsync().await() }
} }
/**
* Provides notification functionality, manages notification channels.
*/
val notificationManager by lazy {
NotificationManager(context)
}
} }

View File

@ -13,7 +13,7 @@ import org.mozilla.fenix.test.Mockable
@Mockable @Mockable
class Components(private val context: Context) { class Components(private val context: Context) {
val backgroundServices by lazy { val backgroundServices by lazy {
BackgroundServices(context, core.historyStorage, core.bookmarksStorage, utils.notificationManager) BackgroundServices(context, core.historyStorage, core.bookmarksStorage)
} }
val services by lazy { Services(backgroundServices.accountManager) } val services by lazy { Services(backgroundServices.accountManager) }
val core by lazy { Core(context) } val core by lazy { Core(context) }

View File

@ -39,12 +39,5 @@ class Utilities(
CustomTabIntentProcessor(sessionManager, sessionUseCases.loadUrl, context.resources) CustomTabIntentProcessor(sessionManager, sessionUseCases.loadUrl, context.resources)
} }
/**
* Provides notification functionality, manages notification channels.
*/
val notificationManager by lazy {
NotificationManager(context)
}
val publicSuffixList by lazy { PublicSuffixList(context) } val publicSuffixList by lazy { PublicSuffixList(context) }
} }