diff --git a/app/src/main/java/org/mozilla/fenix/search/awesomebar/AwesomeBarView.kt b/app/src/main/java/org/mozilla/fenix/search/awesomebar/AwesomeBarView.kt index 0f0a0b5d61..e3aea4fa4e 100644 --- a/app/src/main/java/org/mozilla/fenix/search/awesomebar/AwesomeBarView.kt +++ b/app/src/main/java/org/mozilla/fenix/search/awesomebar/AwesomeBarView.kt @@ -14,6 +14,7 @@ import mozilla.components.browser.state.state.searchEngines import mozilla.components.concept.awesomebar.AwesomeBar import mozilla.components.concept.engine.EngineSession import mozilla.components.feature.awesomebar.provider.BookmarksStorageSuggestionProvider +import mozilla.components.feature.awesomebar.provider.HistoryMetadataSuggestionProvider import mozilla.components.feature.awesomebar.provider.HistoryStorageSuggestionProvider import mozilla.components.feature.awesomebar.provider.SearchActionProvider import mozilla.components.feature.awesomebar.provider.SearchEngineSuggestionProvider @@ -25,6 +26,7 @@ import mozilla.components.feature.syncedtabs.DeviceIndicators import mozilla.components.feature.syncedtabs.SyncedTabsStorageSuggestionProvider import mozilla.components.feature.tabs.TabsUseCases import mozilla.components.support.ktx.android.content.getColorFromAttr +import org.mozilla.fenix.FeatureFlags import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.browser.browsingmode.BrowsingMode @@ -44,6 +46,7 @@ class AwesomeBarView( ) { private val sessionProvider: SessionSuggestionProvider private val historyStorageProvider: HistoryStorageSuggestionProvider + private val historyMetadataProvider: HistoryMetadataSuggestionProvider private val shortcutsEnginePickerProvider: ShortcutsSuggestionProvider private val bookmarksStorageSuggestionProvider: BookmarksStorageSuggestionProvider private val syncedTabsStorageSuggestionProvider: SyncedTabsStorageSuggestionProvider @@ -117,6 +120,15 @@ class AwesomeBarView( engineForSpeculativeConnects ) + historyMetadataProvider = + HistoryMetadataSuggestionProvider( + historyStorage = components.core.historyStorage, + loadUrlUseCase = loadUrlUseCase, + icons = components.core.icons, + engine = engineForSpeculativeConnects, + maxNumberOfSuggestions = METADATA_SUGGESTION_LIMIT + ) + bookmarksStorageSuggestionProvider = BookmarksStorageSuggestionProvider( bookmarksStorage = components.core.bookmarksStorage, @@ -238,7 +250,11 @@ class AwesomeBarView( val providersToAdd = mutableSetOf() if (state.showHistorySuggestions) { - providersToAdd.add(historyStorageProvider) + if (FeatureFlags.historyMetadataFeature) { + providersToAdd.add(historyMetadataProvider) + } else { + providersToAdd.add(historyStorageProvider) + } } if (state.showBookmarkSuggestions) { @@ -268,7 +284,11 @@ class AwesomeBarView( providersToRemove.add(shortcutsEnginePickerProvider) if (!state.showHistorySuggestions) { - providersToRemove.add(historyStorageProvider) + if (FeatureFlags.historyMetadataFeature) { + providersToRemove.add(historyMetadataProvider) + } else { + providersToRemove.add(historyStorageProvider) + } } if (!state.showBookmarkSuggestions) { @@ -348,4 +368,9 @@ class AwesomeBarView( ) } } + + companion object { + // Maximum number of suggestions returned from the history metadata storage. + const val METADATA_SUGGESTION_LIMIT = 3 + } } diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index 7ddb671b38..9d34fcf154 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "92.0.20210721180104" + const val VERSION = "92.0.20210722190406" }