2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Perform Fennec data migration within fennecProduction

This commit is contained in:
Grisha Kruglov 2019-10-18 19:19:22 -07:00 committed by Sebastian Kaspari
parent a0ca8b84bb
commit 9ffff79a88
4 changed files with 45 additions and 2 deletions

View File

@ -393,6 +393,9 @@ dependencies {
implementation Deps.mozilla_support_rustlog
implementation Deps.mozilla_support_utils
// We only care about support-migration in builds that will be overwriting Fennec.
fennecProductionImplementation Deps.mozilla_support_migration
implementation Deps.mozilla_ui_colors
implementation Deps.mozilla_ui_icons
implementation Deps.mozilla_ui_publicsuffixlist

View File

@ -7,6 +7,11 @@
- https://issuetracker.google.com/issues/36905922
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:sharedUserId="${sharedUserId}">
xmlns:tools="http://schemas.android.com/tools"
android:sharedUserId="${sharedUserId}">
<application
android:name="org.mozilla.fenix.MigratingFenixApplication"
tools:replace="android:name">
</application>
</manifest>

View File

@ -0,0 +1,34 @@
/* 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 org.mozilla.fenix
import mozilla.components.support.ktx.android.content.isMainProcess
import mozilla.components.support.migration.FennecMigrator
/**
* An application class which knows how to migrate Fennec data.
*/
class MigratingFenixApplication : FenixApplication() {
override fun setupApplication() {
super.setupApplication()
// Same check as is present in super.setupApplication:
if (!isMainProcess()) {
// If this is not the main process then do not continue with the migration here.
// Migration only needs to be done in our app's main process and should not be done in other processes like
// a GeckoView child process or the crash handling process. Most importantly we never want to end up in a
// situation where we create a GeckoRuntime from the Gecko child process.
return
}
val migrator = FennecMigrator.Builder(this)
.migrateOpenTabs(this.components.core.sessionManager)
.migrateHistory(this.components.core.historyStorage)
.migrateBookmarks(this.components.core.bookmarksStorage)
.build()
migrator.migrateAsync()
}
}

View File

@ -42,7 +42,7 @@ object Versions {
// that we depend on directly for the fenix-megazord (and for it's
// forUnitTest variant), and it's important that it be kept in
// sync with the version used by android-components above.
const val mozilla_appservices = "0.41.0"
const val mozilla_appservices = "0.42.0"
const val autodispose = "1.1.0"
const val adjust = "4.11.4"
@ -153,6 +153,7 @@ object Deps {
const val mozilla_support_rustlog = "org.mozilla.components:support-rustlog:${Versions.mozilla_android_components}"
const val mozilla_support_utils = "org.mozilla.components:support-utils:${Versions.mozilla_android_components}"
const val mozilla_support_test = "org.mozilla.components:support-test:${Versions.mozilla_android_components}"
const val mozilla_support_migration = "org.mozilla.components:support-migration:${Versions.mozilla_android_components}"
const val sentry = "io.sentry:sentry-android:${Versions.sentry}"
const val leakcanary = "com.squareup.leakcanary:leakcanary-android:${Versions.leakcanary}"