Update Android Components version (#21109)

* Update Android Components version to 93.0.20210901143120.

* For #21043 - Integrate AC changes

* Fix breaking API changes of RestoreAction

Co-authored-by: Mugurell <Mugurell@users.noreply.github.com>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
upstream-sync
Mickey Moz 3 years ago committed by GitHub
parent b7c2c0eb0b
commit 4c30483c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -367,26 +367,6 @@ android.applicationVariants.all { variant ->
println("--")
}
// -------------------------------------------------------------------------------------------------
// Pocket recommendations: Read token from local file if it exists (Only debug builds)
// -------------------------------------------------------------------------------------------------
print("Pocket recommendations token: ")
if (isDebug) {
if (gradle.hasProperty("localProperties.pocketConsumerKey")) {
def token = gradle.getProperty("localProperties.pocketConsumerKey")
buildConfigField 'String', 'POCKET_TOKEN', '"' + token + '"'
println "Added from local.properties file"
} else {
buildConfigField 'String', 'POCKET_TOKEN', '""'
println "Not found in local.properties file"
}
} else {
buildConfigField 'String', 'POCKET_TOKEN', '""'
println "Is to be only used in debug"
}
// -------------------------------------------------------------------------------------------------
// BuildConfig: Set flag for official builds; similar to MOZILLA_OFFICIAL in mozilla-central.
// -------------------------------------------------------------------------------------------------

@ -324,9 +324,7 @@ class Core(
@Suppress("MagicNumber")
val pocketStoriesConfig by lazyMonitored {
PocketStoriesConfig(
BuildConfig.POCKET_TOKEN, client, Frequency(4, TimeUnit.HOURS), 7
)
PocketStoriesConfig(client, Frequency(4, TimeUnit.HOURS))
}
val pocketStoriesService by lazyMonitored { PocketStoriesService(context, pocketStoriesConfig) }

@ -69,7 +69,6 @@ import mozilla.components.feature.top.sites.TopSitesConfig
import mozilla.components.feature.top.sites.TopSitesFeature
import mozilla.components.lib.state.ext.consumeFlow
import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.service.pocket.stories.PocketStoriesUseCases
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.ktx.android.content.res.resolveAttribute
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
@ -243,7 +242,7 @@ class HomeFragment : Fragment() {
if (requireContext().settings().pocketRecommendations) {
lifecycleScope.async(IO) {
val stories = PocketStoriesUseCases().GetPocketStories(requireContext()).invoke()
val stories = components.core.pocketStoriesService.getStories()
homeFragmentStore.dispatch(HomeFragmentAction.PocketArticlesChange(stories))
}
}

@ -90,7 +90,7 @@ fun PocketStory(
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
modifier = Modifier.padding(bottom = 2.dp),
text = story.domain,
text = story.publisher,
style = MaterialTheme.typography.caption,
maxLines = 1,
overflow = TextOverflow.Ellipsis
@ -170,13 +170,6 @@ fun PocketRecommendations(
) {
content()
// Don't yet have the bottom image from designs as a proper Android SVG.
Box(
Modifier
.background(Color.Red)
.size(64.dp, 27.dp)
.padding(top = 16.dp)
)
// Image(
// painterResource(R.drawable.ic_firefox_pocket),
// "Firefox and Pocket logos",
@ -269,15 +262,12 @@ private fun getFakePocketStories(limit: Int = 1): List<PocketRecommendedStory> {
add(
PocketRecommendedStory(
id = randomNumber.toLong(),
url = "https://story$randomNumber.com",
title = "This is a ${"very ".repeat(randomNumber)} long title",
domain = "Website no #$randomNumber",
excerpt = "FOO",
dedupeUrl = "BAR",
imageSrc = "",
sortId = randomNumber,
publishedTimestamp = randomNumber.toString()
publisher = "Publisher",
url = "https://story$randomNumber.com",
imageUrl = "",
timeToRead = randomNumber,
category = "Category #$randomNumber"
)
)
}

@ -13,6 +13,8 @@ import mozilla.components.lib.state.ext.observeAsComposableState
import mozilla.components.service.pocket.PocketRecommendedStory
import org.mozilla.fenix.home.HomeFragmentStore
private const val STORIES_TO_SHOW_COUNT = 7
/**
* [RecyclerView.ViewHolder] that will display a list of [PocketRecommendedStory]es
* which is to be provided in the [bind] method.
@ -41,11 +43,13 @@ class PocketStoriesViewHolder(
@Composable
fun PocketStories(store: HomeFragmentStore) {
val stories = store.observeAsComposableState { state -> state.pocketArticles }
val stories = store
.observeAsComposableState { state -> state.pocketArticles }.value
?.take(STORIES_TO_SHOW_COUNT)
ExpandableCard {
PocketRecommendations {
PocketStories(stories.value ?: emptyList())
PocketStories(stories ?: emptyList())
}
}
}

@ -15,6 +15,7 @@ import mozilla.components.browser.state.action.EngineAction
import mozilla.components.browser.state.action.TabListAction
import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.createTab
import mozilla.components.browser.state.state.recover.RecoverableTab
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.service.glean.testing.GleanTestRule
import mozilla.components.support.base.android.Clock
@ -168,11 +169,16 @@ class TelemetryMiddlewareTest {
fun `WHEN tabs are restored THEN the open tab count is updated`() {
assertEquals(0, settings.openTabsCount)
val tabsToRestore = listOf(
createTab("https://mozilla.org"),
createTab("https://firefox.com")
RecoverableTab(url = "https://mozilla.org", id = "1"),
RecoverableTab(url = "https://firefox.com", id = "2")
)
store.dispatch(TabListAction.RestoreAction(tabsToRestore)).joinBlocking()
store.dispatch(
TabListAction.RestoreAction(
tabs = tabsToRestore,
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING
)
).joinBlocking()
assertEquals(2, settings.openTabsCount)
verify(exactly = 1) { metrics.track(Event.HaveOpenTabs) }
}
@ -204,11 +210,12 @@ class TelemetryMiddlewareTest {
store.dispatch(
TabListAction.RestoreAction(
listOf(
createTab("https://www.mozilla.org", id = "foreground"),
createTab("https://getpocket.com", id = "background_pocket"),
createTab("https://theverge.com", id = "background_verge")
RecoverableTab(url = "https://www.mozilla.org", id = "foreground"),
RecoverableTab(url = "https://getpocket.com", id = "background_pocket"),
RecoverableTab(url = "https://theverge.com", id = "background_verge")
),
selectedTabId = "foreground"
selectedTabId = "foreground",
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING
)
).joinBlocking()
@ -227,11 +234,12 @@ class TelemetryMiddlewareTest {
store.dispatch(
TabListAction.RestoreAction(
listOf(
createTab("https://www.mozilla.org", id = "foreground"),
createTab("https://getpocket.com", id = "background_pocket"),
createTab("https://theverge.com", id = "background_verge")
RecoverableTab(url = "https://www.mozilla.org", id = "foreground"),
RecoverableTab(url = "https://getpocket.com", id = "background_pocket"),
RecoverableTab(url = "https://theverge.com", id = "background_verge")
),
selectedTabId = "foreground"
selectedTabId = "foreground",
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING
)
).joinBlocking()
@ -260,11 +268,12 @@ class TelemetryMiddlewareTest {
store.dispatch(
TabListAction.RestoreAction(
listOf(
createTab("https://www.mozilla.org", id = "foreground"),
createTab("https://getpocket.com", id = "background_pocket"),
createTab("https://theverge.com", id = "background_verge")
RecoverableTab(url = "https://www.mozilla.org", id = "foreground"),
RecoverableTab(url = "https://getpocket.com", id = "background_pocket"),
RecoverableTab(url = "https://theverge.com", id = "background_verge")
),
selectedTabId = "foreground"
selectedTabId = "foreground",
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING
)
).joinBlocking()
@ -296,11 +305,12 @@ class TelemetryMiddlewareTest {
store.dispatch(
TabListAction.RestoreAction(
listOf(
createTab("https://www.mozilla.org", id = "foreground"),
createTab("https://getpocket.com", id = "background_pocket"),
createTab("https://theverge.com", id = "background_verge")
RecoverableTab(url = "https://www.mozilla.org", id = "foreground"),
RecoverableTab(url = "https://getpocket.com", id = "background_pocket"),
RecoverableTab(url = "https://theverge.com", id = "background_verge")
),
selectedTabId = "foreground"
selectedTabId = "foreground",
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING
)
).joinBlocking()

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
object AndroidComponents {
const val VERSION = "93.0.20210830220733"
const val VERSION = "93.0.20210901143120"
}

Loading…
Cancel
Save