Migrate 'settings' before app init
parent
dd701233f5
commit
fe92332ff1
|
@ -15,7 +15,6 @@ import mozilla.components.support.migration.state.MigrationStore
|
||||||
class MigratingFenixApplication : FenixApplication() {
|
class MigratingFenixApplication : FenixApplication() {
|
||||||
val migrator by lazy {
|
val migrator by lazy {
|
||||||
FennecMigrator.Builder(this, this.components.analytics.crashReporter)
|
FennecMigrator.Builder(this, this.components.analytics.crashReporter)
|
||||||
.migrateSettings()
|
|
||||||
.migrateOpenTabs(this.components.core.sessionManager)
|
.migrateOpenTabs(this.components.core.sessionManager)
|
||||||
.migrateHistory(this.components.core.historyStorage)
|
.migrateHistory(this.components.core.historyStorage)
|
||||||
.migrateBookmarks(this.components.core.bookmarksStorage)
|
.migrateBookmarks(this.components.core.bookmarksStorage)
|
||||||
|
@ -30,16 +29,22 @@ class MigratingFenixApplication : FenixApplication() {
|
||||||
val migrationStore by lazy { MigrationStore() }
|
val migrationStore by lazy { MigrationStore() }
|
||||||
|
|
||||||
override fun setupInMainProcessOnly() {
|
override fun setupInMainProcessOnly() {
|
||||||
migrateGeckoBlocking()
|
// These migrations need to run before regular initialization happens.
|
||||||
|
migrateBlocking()
|
||||||
|
|
||||||
|
// Fenix application initialization can happen now.
|
||||||
super.setupInMainProcessOnly()
|
super.setupInMainProcessOnly()
|
||||||
|
|
||||||
|
// The rest of the migrations can happen now.
|
||||||
migrator.startMigrationIfNeeded(migrationStore, MigrationService::class.java)
|
migrator.startMigrationIfNeeded(migrationStore, MigrationService::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateGeckoBlocking() {
|
private fun migrateBlocking() {
|
||||||
val migrator = FennecMigrator.Builder(this, this.components.analytics.crashReporter)
|
val migrator = FennecMigrator.Builder(this, this.components.analytics.crashReporter)
|
||||||
.migrateGecko()
|
.migrateGecko()
|
||||||
|
// Telemetry may have been disabled in Fennec, so we need to migrate Settings first
|
||||||
|
// to correctly initialize telemetry.
|
||||||
|
.migrateSettings()
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
|
Loading…
Reference in New Issue