|
|
|
@ -38,7 +38,6 @@ import mozilla.components.feature.webnotifications.WebNotificationFeature
|
|
|
|
|
import mozilla.components.lib.dataprotect.SecureAbove22Preferences
|
|
|
|
|
import mozilla.components.lib.dataprotect.generateEncryptionKey
|
|
|
|
|
import mozilla.components.service.sync.logins.SyncableLoginsStorage
|
|
|
|
|
import mozilla.components.support.base.log.logger.Logger
|
|
|
|
|
import org.mozilla.fenix.AppRequestInterceptor
|
|
|
|
|
import org.mozilla.fenix.Config
|
|
|
|
|
import org.mozilla.fenix.FeatureFlags
|
|
|
|
@ -53,8 +52,6 @@ import java.util.concurrent.TimeUnit
|
|
|
|
|
*/
|
|
|
|
|
@Mockable
|
|
|
|
|
class Core(private val context: Context) {
|
|
|
|
|
private val logger = Logger("Core")
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The browser engine component initialized based on the build
|
|
|
|
|
* configuration (see build variants).
|
|
|
|
@ -192,18 +189,9 @@ class Core(private val context: Context) {
|
|
|
|
|
// Use these for startup-path code, where we don't want to do any work that's not strictly necessary.
|
|
|
|
|
// For example, this is how the GeckoEngine delegates (history, logins) are configured.
|
|
|
|
|
// We can fully initialize GeckoEngine without initialized our storage.
|
|
|
|
|
val lazyHistoryStorage = lazy {
|
|
|
|
|
logger.info("Initializing history storage")
|
|
|
|
|
PlacesHistoryStorage(context)
|
|
|
|
|
}
|
|
|
|
|
val lazyBookmarksStorage = lazy {
|
|
|
|
|
logger.info("Initializing bookmarks storage")
|
|
|
|
|
PlacesBookmarksStorage(context)
|
|
|
|
|
}
|
|
|
|
|
val lazyPasswordsStorage = lazy {
|
|
|
|
|
logger.info("Initializing logins storage")
|
|
|
|
|
SyncableLoginsStorage(context, passwordsEncryptionKey)
|
|
|
|
|
}
|
|
|
|
|
val lazyHistoryStorage = lazy { PlacesHistoryStorage(context) }
|
|
|
|
|
val lazyBookmarksStorage = lazy { PlacesBookmarksStorage(context) }
|
|
|
|
|
val lazyPasswordsStorage = lazy { SyncableLoginsStorage(context, passwordsEncryptionKey) }
|
|
|
|
|
|
|
|
|
|
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
|
|
|
|
|
val historyStorage by lazy { lazyHistoryStorage.value }
|
|
|
|
|