Skip to content

Commit

Permalink
Add history storage and configure it to be synchronized
Browse files Browse the repository at this point in the history
  • Loading branch information
Grisha Kruglov committed Jul 17, 2019
1 parent c82c252 commit dd0f53c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/src/common/shared/org/mozilla/vrbrowser/browser/Places.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ package org.mozilla.vrbrowser.browser

import android.content.Context
import mozilla.components.browser.storage.sync.PlacesBookmarksStorage
import mozilla.components.browser.storage.sync.PlacesHistoryStorage

/**
* Entry point for interacting with places-backed storage layers.
*/
class Places(context: Context) {
val bookmarks by lazy { PlacesBookmarksStorage(context) }
val history by lazy { PlacesHistoryStorage(context) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Services(context: Context, places: Places) {
Log.addSink(AndroidLogSink())

GlobalSyncableStoreProvider.configureStore("bookmarks" to places.bookmarks)
GlobalSyncableStoreProvider.configureStore("history" to places.history)

// TODO this really shouldn't be necessary, since WorkManager auto-initializes itself, unless
// auto-initialization is disabled in the manifest file. We don't disable the initialization,
Expand Down Expand Up @@ -87,7 +88,7 @@ class Services(context: Context, places: Places) {
),
// If background syncing is desired, pass in a 'syncPeriodInMinutes' parameter.
// As-is, sync will run on app startup.
syncConfig = SyncConfig(setOf("bookmarks"))
syncConfig = SyncConfig(setOf("bookmarks", "history"))
).also {
it.registerForDeviceEvents(deviceEventObserver, ProcessLifecycleOwner.get(), true)
}
Expand Down

0 comments on commit dd0f53c

Please sign in to comment.