Commit 7a272a45 authored by Grisha Kruglov's avatar Grisha Kruglov Committed by Sebastian Kaspari
Browse files

Enable fennec Pinned Sites migration

parent e73b3cfb
...@@ -14,7 +14,7 @@ import org.mozilla.fenix.test.Mockable ...@@ -14,7 +14,7 @@ import org.mozilla.fenix.test.Mockable
class TopSiteStorage(private val context: Context) { class TopSiteStorage(private val context: Context) {
var cachedTopSites = listOf<TopSite>() var cachedTopSites = listOf<TopSite>()
private val topSiteStorage by lazy { val storage by lazy {
TopSiteStorage(context) TopSiteStorage(context)
} }
...@@ -22,20 +22,20 @@ class TopSiteStorage(private val context: Context) { ...@@ -22,20 +22,20 @@ class TopSiteStorage(private val context: Context) {
* Adds a new [TopSite]. * Adds a new [TopSite].
*/ */
fun addTopSite(title: String, url: String) { fun addTopSite(title: String, url: String) {
topSiteStorage.addTopSite(title, url) storage.addTopSite(title, url)
} }
/** /**
* Returns a [LiveData] list of all the [TopSite] instances. * Returns a [LiveData] list of all the [TopSite] instances.
*/ */
fun getTopSites(): LiveData<List<TopSite>> { fun getTopSites(): LiveData<List<TopSite>> {
return topSiteStorage.getTopSites() return storage.getTopSites()
} }
/** /**
* Removes the given [TopSite]. * Removes the given [TopSite].
*/ */
fun removeTopSite(topSite: TopSite) { fun removeTopSite(topSite: TopSite) {
topSiteStorage.removeTopSite(topSite) storage.removeTopSite(topSite)
} }
} }
...@@ -16,7 +16,10 @@ class MigratingFenixApplication : FenixApplication() { ...@@ -16,7 +16,10 @@ class MigratingFenixApplication : FenixApplication() {
FennecMigrator.Builder(this, this.components.analytics.crashReporter) FennecMigrator.Builder(this, this.components.analytics.crashReporter)
.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,
this.components.core.topSiteStorage.storage
)
.migrateLogins( .migrateLogins(
this.components.core.asyncPasswordsStorage, this.components.core.asyncPasswordsStorage,
this.components.core.passwordsEncryptionKey this.components.core.passwordsEncryptionKey
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment