upgrade to gecko 149.0

This commit is contained in:
Fabian Freund
2026-03-26 16:32:16 +01:00
parent 8c08f6262f
commit 0c6d669185
21 changed files with 293 additions and 444 deletions
@@ -3,7 +3,7 @@ version = "1.0-SNAPSHOT"
buildscript {
ext.kotlin_version = "2.3.10"
ext.mozillaComponentsVersion = '148.0.2'
ext.mozillaComponentsVersion = '149.0'
repositories {
google()
@@ -25,13 +25,13 @@ import eu.weblibre.flutter_mozilla_components.pigeons.GeckoTabContentEvents
import eu.weblibre.flutter_mozilla_components.pigeons.ReaderViewController
import mozilla.components.concept.engine.EngineView
import mozilla.components.concept.engine.selection.SelectionActionDelegate
import mozilla.components.feature.downloads.DateTimeProvider
import mozilla.components.feature.downloads.DefaultDateTimeProvider
import mozilla.components.feature.downloads.DefaultFileSizeFormatter
import mozilla.components.feature.downloads.DownloadEstimator
import mozilla.components.feature.downloads.FileSizeFormatter
import mozilla.components.support.base.android.NotificationsDelegate
import mozilla.components.support.base.log.Log
import mozilla.components.support.utils.DateTimeProvider
import mozilla.components.support.utils.DefaultDateTimeProvider
class Components(val profileApplicationContext: ProfileContext,
val flutterEvents: GeckoStateEvents,
@@ -119,6 +119,7 @@ object GlobalComponents {
// first full setup. We restore the tab list, but let startup open in
// its neutral/default state instead of jumping back into prior content.
selectedTabId = null,
tabPartitions = restoredState.tabPartitions
),
restoreLocation = TabListAction.RestoreAction.RestoreLocation.BEGINNING,
)
@@ -25,6 +25,7 @@ import mozilla.components.support.base.feature.LifecycleAwareFeature
import mozilla.components.support.ktx.android.content.appVersionName
import mozilla.components.ui.widgets.withCenterAlignedButtons
import eu.weblibre.flutter_mozilla_components.R
import kotlinx.coroutines.Dispatchers
import mozilla.components.feature.addons.R as MozComp
/**
@@ -47,7 +48,7 @@ class WebExtensionPromptFeature(
* and opens / closes tabs as needed.
*/
override fun start() {
scope = store.flowScoped { flow ->
scope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state ->
state.webExtensionPromptRequest
}.distinctUntilChanged().collect { promptRequest ->
@@ -17,6 +17,7 @@ import kotlinx.coroutines.launch
import mozilla.components.concept.sync.DeviceCapability
import mozilla.components.concept.sync.DeviceCommandOutgoing
import mozilla.components.concept.sync.TabData
import mozilla.components.concept.sync.TabPrivacy
import mozilla.components.service.fxa.SyncEngine
import mozilla.components.service.fxa.manager.SCOPE_PROFILE
import mozilla.components.service.fxa.manager.SCOPE_SYNC
@@ -217,7 +218,8 @@ class GeckoSyncApiImpl : GeckoSyncApi {
deviceId: String,
title: String,
url: String,
callback: (Result<Boolean>) -> Unit,
private: Boolean,
callback: (Result<Boolean>) -> Unit
) {
coroutineScope.launch {
runCatching {
@@ -237,6 +239,7 @@ class GeckoSyncApiImpl : GeckoSyncApi {
DeviceCommandOutgoing.SendTab(
title = title,
url = url,
privacy = if (private) TabPrivacy.Private else TabPrivacy.Normal,
),
)
}.fold(
@@ -10,7 +10,6 @@ import eu.weblibre.flutter_mozilla_components.pigeons.AddTabParams
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoTabsApi
import eu.weblibre.flutter_mozilla_components.pigeons.HistoryMetadataKey as PigeonHistoryMetadataKey
import eu.weblibre.flutter_mozilla_components.pigeons.LoadUrlFlagsValue
import eu.weblibre.flutter_mozilla_components.pigeons.RecoverableBrowserState as PigeonRecoverableBrowserState
import eu.weblibre.flutter_mozilla_components.pigeons.RestoreLocation as PigeonRestoreLocation
import eu.weblibre.flutter_mozilla_components.pigeons.RecoverableTab as PigeonRecoverableTab
import eu.weblibre.flutter_mozilla_components.pigeons.SourceValue
@@ -601,25 +600,6 @@ class GeckoTabsApiImpl : GeckoTabsApi {
}
}
override fun restoreTabsByBrowserState(
state: PigeonRecoverableBrowserState,
restoreLocation: PigeonRestoreLocation
) {
try {
components.useCases.tabsUseCases.restore(
state = RecoverableBrowserState(
selectedTabId = state.selectedTabId,
tabs = state.tabs.filterNotNull().map { mapTab(it) }
),
restoreLocation = mapRestoreLocation(restoreLocation)
)
logger.debug("$TAG: Restored browser state")
} catch (e: Exception) {
logger.error("$TAG: Failed to restore browser state", e)
throw e
}
}
override fun selectOrAddTabByHistory(
url: String,
historyMetadata: PigeonHistoryMetadataKey
@@ -26,6 +26,7 @@ import eu.weblibre.flutter_mozilla_components.pigeons.TabContentState
import eu.weblibre.flutter_mozilla_components.pigeons.TabTranslationStateData
import eu.weblibre.flutter_mozilla_components.pigeons.TranslationEngineStateData
import eu.weblibre.flutter_mozilla_components.pigeons.TranslationLanguage
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.debounce
@@ -50,7 +51,7 @@ class Events(
@OptIn(FlowPreview::class)
fun registerFlowEvents(stateFlow: Store<BrowserState, BrowserAction>) {
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.map { state -> state.selectedTabId }
.distinctUntilChanged()
// Make sure this is sent after tabadded action and tab list change
@@ -63,7 +64,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
var previousTabs = emptySet<String>()
flow.mapNotNull { state -> state.tabs.map { tab -> tab.id } }
.distinctUntilChanged()
@@ -88,7 +89,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.content
@@ -105,7 +106,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.content.securityInfo
@@ -124,7 +125,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.readerState
@@ -148,7 +149,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.content
@@ -180,7 +181,7 @@ class Events(
}
}
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.content
@@ -226,7 +227,7 @@ class Events(
}
// Translation engine state (browser-level)
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.map { state -> state.translationEngine }
.distinctUntilChanged { old, new ->
old.isEngineSupported == new.isEngineSupported &&
@@ -253,7 +254,7 @@ class Events(
}
// Per-tab translation state
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.tabs }
.filterChanged {
it.translationsState
@@ -291,7 +292,7 @@ class Events(
}
// PWA manifest availability events - following Fenix MenuPresenter pattern
stateFlow.flowScoped { flow ->
stateFlow.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.mapNotNull { state -> state.selectedTab }
.ifAnyChanged { tab ->
arrayOf(
@@ -10,6 +10,7 @@ import eu.weblibre.flutter_mozilla_components.ext.EventSequence
import eu.weblibre.flutter_mozilla_components.pigeons.GeckoTabContentEvents
import eu.weblibre.flutter_mozilla_components.pigeons.TabContent
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.map
import mozilla.components.browser.state.store.BrowserStore
@@ -87,7 +88,7 @@ class ReadabilityExtractFeature(
extensionController.install(
engine,
onSuccess = { extension ->
sessionScope = store.flowScoped { flow ->
sessionScope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.map { it.tabs }
.filterChanged { it.engineState.engineSession }
.collect { state ->
@@ -102,7 +103,7 @@ class ReadabilityExtractFeature(
}
}
historyScope = store.flowScoped { flow ->
historyScope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.map { it.tabs }
.filterChanged { it.content.history }
.ifAnyChanged { arrayOf(it.content.history.currentIndex) }
@@ -86,7 +86,7 @@ class WebExtensionToolbarFeature(
}
iconJobDispatcher = iconHandler.asCoroutineDispatcher("WebExtensionIconDispatcher")
scope = store.flowScoped { flow ->
scope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow.ifAnyChanged { arrayOf(it.selectedTab, it.extensions) }
.collect { state ->
renderWebExtensionActions(state, state.selectedTab)
@@ -1338,43 +1338,6 @@ data class RecoverableTab (
override fun hashCode(): Int = toList().hashCode()
}
/**
* A restored browser state, read from disk.
*
* Generated class from Pigeon that represents data sent in messages.
*/
data class RecoverableBrowserState (
/** The list of restored tabs. */
val tabs: List<RecoverableTab?>,
/** The ID of the selected tab in [tabs]. Or `null` if no selection was restored. */
val selectedTabId: String? = null
)
{
companion object {
fun fromList(pigeonVar_list: List<Any?>): RecoverableBrowserState {
val tabs = pigeonVar_list[0] as List<RecoverableTab?>
val selectedTabId = pigeonVar_list[1] as String?
return RecoverableBrowserState(tabs, selectedTabId)
}
}
fun toList(): List<Any?> {
return listOf(
tabs,
selectedTabId,
)
}
override fun equals(other: Any?): Boolean {
if (other !is RecoverableBrowserState) {
return false
}
if (this === other) {
return true
}
return GeckoPigeonUtils.deepEquals(toList(), other.toList()) }
override fun hashCode(): Int = toList().hashCode()
}
/**
* A request to load an [Icon].
*
@@ -4111,290 +4074,285 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
}
178.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
RecoverableBrowserState.fromList(it)
IconRequest.fromList(it)
}
}
179.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
IconRequest.fromList(it)
ResourceSize.fromList(it)
}
}
180.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ResourceSize.fromList(it)
Resource.fromList(it)
}
}
181.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
Resource.fromList(it)
IconResult.fromList(it)
}
}
182.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
IconResult.fromList(it)
CookiePartitionKey.fromList(it)
}
}
183.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
CookiePartitionKey.fromList(it)
Cookie.fromList(it)
}
}
184.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
Cookie.fromList(it)
VisitInfo.fromList(it)
}
}
185.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
VisitInfo.fromList(it)
HistoryHighlightWeights.fromList(it)
}
}
186.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryHighlightWeights.fromList(it)
HistoryHighlight.fromList(it)
}
}
187.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryHighlight.fromList(it)
TopFrecentSiteInfo.fromList(it)
}
}
188.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TopFrecentSiteInfo.fromList(it)
HistoryItem.fromList(it)
}
}
189.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryItem.fromList(it)
HistoryState.fromList(it)
}
}
190.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
HistoryState.fromList(it)
ReaderableState.fromList(it)
}
}
191.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ReaderableState.fromList(it)
SecurityInfoState.fromList(it)
}
}
192.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SecurityInfoState.fromList(it)
TabContentState.fromList(it)
}
}
193.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TabContentState.fromList(it)
FindResultState.fromList(it)
}
}
194.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
FindResultState.fromList(it)
CustomSelectionAction.fromList(it)
}
}
195.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
CustomSelectionAction.fromList(it)
WebExtensionData.fromList(it)
}
}
196.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
WebExtensionData.fromList(it)
GeckoSuggestion.fromList(it)
}
}
197.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoSuggestion.fromList(it)
TabContent.fromList(it)
}
}
198.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TabContent.fromList(it)
ContentBlocking.fromList(it)
}
}
199.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ContentBlocking.fromList(it)
DohSettings.fromList(it)
}
}
200.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
DohSettings.fromList(it)
GeckoEngineSettings.fromList(it)
}
}
201.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoEngineSettings.fromList(it)
AutocompleteResult.fromList(it)
}
}
202.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AutocompleteResult.fromList(it)
UnknownHitResult.fromList(it)
}
}
203.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
UnknownHitResult.fromList(it)
ImageHitResult.fromList(it)
}
}
204.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ImageHitResult.fromList(it)
VideoHitResult.fromList(it)
}
}
205.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
VideoHitResult.fromList(it)
AudioHitResult.fromList(it)
}
}
206.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AudioHitResult.fromList(it)
ImageSrcHitResult.fromList(it)
}
}
207.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ImageSrcHitResult.fromList(it)
PhoneHitResult.fromList(it)
}
}
208.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
PhoneHitResult.fromList(it)
EmailHitResult.fromList(it)
}
}
209.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
EmailHitResult.fromList(it)
GeoHitResult.fromList(it)
}
}
210.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeoHitResult.fromList(it)
DownloadState.fromList(it)
}
}
211.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
DownloadState.fromList(it)
ShareInternetResourceState.fromList(it)
}
}
212.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ShareInternetResourceState.fromList(it)
AddonCollection.fromList(it)
}
}
213.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AddonCollection.fromList(it)
SyncEngineStatus.fromList(it)
}
}
214.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncEngineStatus.fromList(it)
SyncAccountInfo.fromList(it)
}
}
215.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncAccountInfo.fromList(it)
SyncDevice.fromList(it)
}
}
216.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncDevice.fromList(it)
SyncIncomingTab.fromList(it)
}
}
217.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncIncomingTab.fromList(it)
SyncRemoteTab.fromList(it)
}
}
218.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncRemoteTab.fromList(it)
SyncDeviceTabs.fromList(it)
}
}
219.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SyncDeviceTabs.fromList(it)
GeckoPref.fromList(it)
}
}
220.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoPref.fromList(it)
MlProgressData.fromList(it)
}
}
221.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
MlProgressData.fromList(it)
ContainerSiteAssignment.fromList(it)
}
}
222.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ContainerSiteAssignment.fromList(it)
GeckoHeader.fromList(it)
}
}
223.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoHeader.fromList(it)
GeckoFetchRequest.fromList(it)
}
}
224.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoFetchRequest.fromList(it)
GeckoFetchResponse.fromList(it)
}
}
225.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
GeckoFetchResponse.fromList(it)
BookmarkNode.fromList(it)
}
}
226.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
BookmarkNode.fromList(it)
BookmarkInfo.fromList(it)
}
}
227.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
BookmarkInfo.fromList(it)
SitePermissions.fromList(it)
}
}
228.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
SitePermissions.fromList(it)
TrackingProtectionException.fromList(it)
}
}
229.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
TrackingProtectionException.fromList(it)
PwaIcon.fromList(it)
}
}
230.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
PwaIcon.fromList(it)
ShareTargetFiles.fromList(it)
}
}
231.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ShareTargetFiles.fromList(it)
ShareTargetParams.fromList(it)
}
}
232.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ShareTargetParams.fromList(it)
ShareTarget.fromList(it)
}
}
233.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ShareTarget.fromList(it)
}
}
234.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
ExternalApplicationResource.fromList(it)
}
}
235.toByte() -> {
234.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
PwaManifest.fromList(it)
}
@@ -4600,236 +4558,232 @@ private open class GeckoPigeonCodec : StandardMessageCodec() {
stream.write(177)
writeValue(stream, value.toList())
}
is RecoverableBrowserState -> {
is IconRequest -> {
stream.write(178)
writeValue(stream, value.toList())
}
is IconRequest -> {
is ResourceSize -> {
stream.write(179)
writeValue(stream, value.toList())
}
is ResourceSize -> {
is Resource -> {
stream.write(180)
writeValue(stream, value.toList())
}
is Resource -> {
is IconResult -> {
stream.write(181)
writeValue(stream, value.toList())
}
is IconResult -> {
is CookiePartitionKey -> {
stream.write(182)
writeValue(stream, value.toList())
}
is CookiePartitionKey -> {
is Cookie -> {
stream.write(183)
writeValue(stream, value.toList())
}
is Cookie -> {
is VisitInfo -> {
stream.write(184)
writeValue(stream, value.toList())
}
is VisitInfo -> {
is HistoryHighlightWeights -> {
stream.write(185)
writeValue(stream, value.toList())
}
is HistoryHighlightWeights -> {
is HistoryHighlight -> {
stream.write(186)
writeValue(stream, value.toList())
}
is HistoryHighlight -> {
is TopFrecentSiteInfo -> {
stream.write(187)
writeValue(stream, value.toList())
}
is TopFrecentSiteInfo -> {
is HistoryItem -> {
stream.write(188)
writeValue(stream, value.toList())
}
is HistoryItem -> {
is HistoryState -> {
stream.write(189)
writeValue(stream, value.toList())
}
is HistoryState -> {
is ReaderableState -> {
stream.write(190)
writeValue(stream, value.toList())
}
is ReaderableState -> {
is SecurityInfoState -> {
stream.write(191)
writeValue(stream, value.toList())
}
is SecurityInfoState -> {
is TabContentState -> {
stream.write(192)
writeValue(stream, value.toList())
}
is TabContentState -> {
is FindResultState -> {
stream.write(193)
writeValue(stream, value.toList())
}
is FindResultState -> {
is CustomSelectionAction -> {
stream.write(194)
writeValue(stream, value.toList())
}
is CustomSelectionAction -> {
is WebExtensionData -> {
stream.write(195)
writeValue(stream, value.toList())
}
is WebExtensionData -> {
is GeckoSuggestion -> {
stream.write(196)
writeValue(stream, value.toList())
}
is GeckoSuggestion -> {
is TabContent -> {
stream.write(197)
writeValue(stream, value.toList())
}
is TabContent -> {
is ContentBlocking -> {
stream.write(198)
writeValue(stream, value.toList())
}
is ContentBlocking -> {
is DohSettings -> {
stream.write(199)
writeValue(stream, value.toList())
}
is DohSettings -> {
is GeckoEngineSettings -> {
stream.write(200)
writeValue(stream, value.toList())
}
is GeckoEngineSettings -> {
is AutocompleteResult -> {
stream.write(201)
writeValue(stream, value.toList())
}
is AutocompleteResult -> {
is UnknownHitResult -> {
stream.write(202)
writeValue(stream, value.toList())
}
is UnknownHitResult -> {
is ImageHitResult -> {
stream.write(203)
writeValue(stream, value.toList())
}
is ImageHitResult -> {
is VideoHitResult -> {
stream.write(204)
writeValue(stream, value.toList())
}
is VideoHitResult -> {
is AudioHitResult -> {
stream.write(205)
writeValue(stream, value.toList())
}
is AudioHitResult -> {
is ImageSrcHitResult -> {
stream.write(206)
writeValue(stream, value.toList())
}
is ImageSrcHitResult -> {
is PhoneHitResult -> {
stream.write(207)
writeValue(stream, value.toList())
}
is PhoneHitResult -> {
is EmailHitResult -> {
stream.write(208)
writeValue(stream, value.toList())
}
is EmailHitResult -> {
is GeoHitResult -> {
stream.write(209)
writeValue(stream, value.toList())
}
is GeoHitResult -> {
is DownloadState -> {
stream.write(210)
writeValue(stream, value.toList())
}
is DownloadState -> {
is ShareInternetResourceState -> {
stream.write(211)
writeValue(stream, value.toList())
}
is ShareInternetResourceState -> {
is AddonCollection -> {
stream.write(212)
writeValue(stream, value.toList())
}
is AddonCollection -> {
is SyncEngineStatus -> {
stream.write(213)
writeValue(stream, value.toList())
}
is SyncEngineStatus -> {
is SyncAccountInfo -> {
stream.write(214)
writeValue(stream, value.toList())
}
is SyncAccountInfo -> {
is SyncDevice -> {
stream.write(215)
writeValue(stream, value.toList())
}
is SyncDevice -> {
is SyncIncomingTab -> {
stream.write(216)
writeValue(stream, value.toList())
}
is SyncIncomingTab -> {
is SyncRemoteTab -> {
stream.write(217)
writeValue(stream, value.toList())
}
is SyncRemoteTab -> {
is SyncDeviceTabs -> {
stream.write(218)
writeValue(stream, value.toList())
}
is SyncDeviceTabs -> {
is GeckoPref -> {
stream.write(219)
writeValue(stream, value.toList())
}
is GeckoPref -> {
is MlProgressData -> {
stream.write(220)
writeValue(stream, value.toList())
}
is MlProgressData -> {
is ContainerSiteAssignment -> {
stream.write(221)
writeValue(stream, value.toList())
}
is ContainerSiteAssignment -> {
is GeckoHeader -> {
stream.write(222)
writeValue(stream, value.toList())
}
is GeckoHeader -> {
is GeckoFetchRequest -> {
stream.write(223)
writeValue(stream, value.toList())
}
is GeckoFetchRequest -> {
is GeckoFetchResponse -> {
stream.write(224)
writeValue(stream, value.toList())
}
is GeckoFetchResponse -> {
is BookmarkNode -> {
stream.write(225)
writeValue(stream, value.toList())
}
is BookmarkNode -> {
is BookmarkInfo -> {
stream.write(226)
writeValue(stream, value.toList())
}
is BookmarkInfo -> {
is SitePermissions -> {
stream.write(227)
writeValue(stream, value.toList())
}
is SitePermissions -> {
is TrackingProtectionException -> {
stream.write(228)
writeValue(stream, value.toList())
}
is TrackingProtectionException -> {
is PwaIcon -> {
stream.write(229)
writeValue(stream, value.toList())
}
is PwaIcon -> {
is ShareTargetFiles -> {
stream.write(230)
writeValue(stream, value.toList())
}
is ShareTargetFiles -> {
is ShareTargetParams -> {
stream.write(231)
writeValue(stream, value.toList())
}
is ShareTargetParams -> {
is ShareTarget -> {
stream.write(232)
writeValue(stream, value.toList())
}
is ShareTarget -> {
is ExternalApplicationResource -> {
stream.write(233)
writeValue(stream, value.toList())
}
is ExternalApplicationResource -> {
stream.write(234)
writeValue(stream, value.toList())
}
is PwaManifest -> {
stream.write(235)
stream.write(234)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
@@ -5010,7 +4964,7 @@ interface GeckoSyncApi {
fun setEngineEnabled(engine: SyncEngineValue, enabled: Boolean, callback: (Result<Unit>) -> Unit)
fun getSyncedTabs(callback: (Result<List<SyncDeviceTabs>>) -> Unit)
fun getDevices(callback: (Result<List<SyncDevice>>) -> Unit)
fun sendTabToDevice(deviceId: String, title: String, url: String, callback: (Result<Boolean>) -> Unit)
fun sendTabToDevice(deviceId: String, title: String, url: String, private: Boolean, callback: (Result<Boolean>) -> Unit)
fun refreshDevices(callback: (Result<Unit>) -> Unit)
fun pollDeviceCommands(callback: (Result<Unit>) -> Unit)
fun drainIncomingTabs(callback: (Result<List<SyncIncomingTab>>) -> Unit)
@@ -5178,7 +5132,8 @@ interface GeckoSyncApi {
val deviceIdArg = args[0] as String
val titleArg = args[1] as String
val urlArg = args[2] as String
api.sendTabToDevice(deviceIdArg, titleArg, urlArg) { result: Result<Boolean> ->
val privateArg = args[3] as Boolean
api.sendTabToDevice(deviceIdArg, titleArg, urlArg, privateArg) { result: Result<Boolean> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(GeckoPigeonUtils.wrapError(error))
@@ -5820,7 +5775,6 @@ interface GeckoTabsApi {
fun removePrivateTabs()
fun undo()
fun restoreTabsByList(tabs: List<RecoverableTab>, selectTabId: String?, restoreLocation: RestoreLocation)
fun restoreTabsByBrowserState(state: RecoverableBrowserState, restoreLocation: RestoreLocation)
/**
* Selects an already existing tab with the matching [HistoryMetadataKey] or otherwise
* creates a new tab with the given [url].
@@ -6056,25 +6010,6 @@ interface GeckoTabsApi {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_mozilla_components.GeckoTabsApi.restoreTabsByBrowserState$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val stateArg = args[0] as RecoverableBrowserState
val restoreLocationArg = args[1] as RestoreLocation
val wrapped: List<Any?> = try {
api.restoreTabsByBrowserState(stateArg, restoreLocationArg)
listOf(null)
} catch (exception: Throwable) {
GeckoPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.flutter_mozilla_components.GeckoTabsApi.selectOrAddTabByHistory$separatedMessageChannelSuffix", codec)
if (api != null) {
@@ -6,15 +6,17 @@
package eu.weblibre.flutter_mozilla_components.services
import android.os.Environment
import eu.weblibre.flutter_mozilla_components.GlobalComponents
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.feature.downloads.AbstractFetchDownloadService
import mozilla.components.feature.downloads.DateTimeProvider
import mozilla.components.feature.downloads.DefaultPackageNameProvider
import mozilla.components.feature.downloads.DownloadEstimator
import mozilla.components.feature.downloads.FileSizeFormatter
import mozilla.components.feature.downloads.PackageNameProvider
import mozilla.components.support.base.android.NotificationsDelegate
import mozilla.components.support.utils.DefaultDownloadFileUtils
import mozilla.components.support.utils.DownloadFileUtils
class DownloadService : AbstractFetchDownloadService() {
private val components by lazy {
@@ -31,4 +33,12 @@ class DownloadService : AbstractFetchDownloadService() {
applicationContext
)
}
override val downloadFileUtils: DownloadFileUtils by lazy {
DefaultDownloadFileUtils(
context = applicationContext,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
)
}
}
@@ -26,6 +26,7 @@ import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import eu.weblibre.flutter_mozilla_components.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.mapNotNull
import mozilla.components.browser.state.selector.findCustomTab
@@ -193,7 +194,7 @@ class CustomTabToolbar @JvmOverloads constructor(
val sessionId = this.sessionId ?: return
val store = this.store ?: return
urlScope = store.flowScoped { flow ->
urlScope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow
.mapNotNull { state -> state.findCustomTab(sessionId) }
.ifAnyChanged { tab -> arrayOf(tab.content.url) }
@@ -208,7 +209,7 @@ class CustomTabToolbar @JvmOverloads constructor(
val sessionId = this.sessionId ?: return
val store = this.store ?: return
titleScope = store.flowScoped { flow ->
titleScope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow
.mapNotNull { state -> state.findCustomTab(sessionId) }
.ifAnyChanged { tab -> arrayOf(tab.content.title) }
@@ -220,7 +221,7 @@ class CustomTabToolbar @JvmOverloads constructor(
val sessionId = this.sessionId ?: return
val store = this.store ?: return
securityScope = store.flowScoped { flow ->
securityScope = store.flowScoped(dispatcher = Dispatchers.Main) { flow ->
flow
.mapNotNull { state -> state.findCustomTab(sessionId) }
.ifAnyChanged {
@@ -42,8 +42,13 @@ class GeckoSyncService {
return _api.getDevices();
}
Future<bool> sendTabToDevice(String deviceId, String title, String url) {
return _api.sendTabToDevice(deviceId, title, url);
Future<bool> sendTabToDevice(
String deviceId,
String title,
String url,
bool private,
) {
return _api.sendTabToDevice(deviceId, title, url, private);
}
Future<void> refreshDevices() {
@@ -116,15 +116,6 @@ class GeckoTabService {
);
}
Future<void> restoreTabsByBrowserState({
required RecoverableBrowserState state,
RestoreLocation restoreLocation = RestoreLocation.end,
}) {
return _api.restoreTabsByBrowserState(
state: state,
restoreLocation: restoreLocation,
);
}
//The calls with engin storage for restore are not supported at the moment
//selectOrAddTab invokes splitted
@@ -1325,55 +1325,6 @@ class RecoverableTab {
;
}
/// A restored browser state, read from disk.
class RecoverableBrowserState {
RecoverableBrowserState({
required this.tabs,
this.selectedTabId,
});
/// The list of restored tabs.
List<RecoverableTab?> tabs;
/// The ID of the selected tab in [tabs]. Or `null` if no selection was restored.
String? selectedTabId;
List<Object?> _toList() {
return <Object?>[
tabs,
selectedTabId,
];
}
Object encode() {
return _toList(); }
static RecoverableBrowserState decode(Object result) {
result as List<Object?>;
return RecoverableBrowserState(
tabs: (result[0] as List<Object?>?)!.cast<RecoverableTab?>(),
selectedTabId: result[1] as String?,
);
}
@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) {
if (other is! RecoverableBrowserState || other.runtimeType != runtimeType) {
return false;
}
if (identical(this, other)) {
return true;
}
return _deepEquals(encode(), other.encode());
}
@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => Object.hashAll(_toList())
;
}
/// A request to load an [Icon].
class IconRequest {
IconRequest({
@@ -5189,179 +5140,176 @@ class _PigeonCodec extends StandardMessageCodec {
} else if (value is RecoverableTab) {
buffer.putUint8(177);
writeValue(buffer, value.encode());
} else if (value is RecoverableBrowserState) {
} else if (value is IconRequest) {
buffer.putUint8(178);
writeValue(buffer, value.encode());
} else if (value is IconRequest) {
} else if (value is ResourceSize) {
buffer.putUint8(179);
writeValue(buffer, value.encode());
} else if (value is ResourceSize) {
} else if (value is Resource) {
buffer.putUint8(180);
writeValue(buffer, value.encode());
} else if (value is Resource) {
} else if (value is IconResult) {
buffer.putUint8(181);
writeValue(buffer, value.encode());
} else if (value is IconResult) {
} else if (value is CookiePartitionKey) {
buffer.putUint8(182);
writeValue(buffer, value.encode());
} else if (value is CookiePartitionKey) {
} else if (value is Cookie) {
buffer.putUint8(183);
writeValue(buffer, value.encode());
} else if (value is Cookie) {
} else if (value is VisitInfo) {
buffer.putUint8(184);
writeValue(buffer, value.encode());
} else if (value is VisitInfo) {
} else if (value is HistoryHighlightWeights) {
buffer.putUint8(185);
writeValue(buffer, value.encode());
} else if (value is HistoryHighlightWeights) {
} else if (value is HistoryHighlight) {
buffer.putUint8(186);
writeValue(buffer, value.encode());
} else if (value is HistoryHighlight) {
} else if (value is TopFrecentSiteInfo) {
buffer.putUint8(187);
writeValue(buffer, value.encode());
} else if (value is TopFrecentSiteInfo) {
} else if (value is HistoryItem) {
buffer.putUint8(188);
writeValue(buffer, value.encode());
} else if (value is HistoryItem) {
} else if (value is HistoryState) {
buffer.putUint8(189);
writeValue(buffer, value.encode());
} else if (value is HistoryState) {
} else if (value is ReaderableState) {
buffer.putUint8(190);
writeValue(buffer, value.encode());
} else if (value is ReaderableState) {
} else if (value is SecurityInfoState) {
buffer.putUint8(191);
writeValue(buffer, value.encode());
} else if (value is SecurityInfoState) {
} else if (value is TabContentState) {
buffer.putUint8(192);
writeValue(buffer, value.encode());
} else if (value is TabContentState) {
} else if (value is FindResultState) {
buffer.putUint8(193);
writeValue(buffer, value.encode());
} else if (value is FindResultState) {
} else if (value is CustomSelectionAction) {
buffer.putUint8(194);
writeValue(buffer, value.encode());
} else if (value is CustomSelectionAction) {
} else if (value is WebExtensionData) {
buffer.putUint8(195);
writeValue(buffer, value.encode());
} else if (value is WebExtensionData) {
} else if (value is GeckoSuggestion) {
buffer.putUint8(196);
writeValue(buffer, value.encode());
} else if (value is GeckoSuggestion) {
} else if (value is TabContent) {
buffer.putUint8(197);
writeValue(buffer, value.encode());
} else if (value is TabContent) {
} else if (value is ContentBlocking) {
buffer.putUint8(198);
writeValue(buffer, value.encode());
} else if (value is ContentBlocking) {
} else if (value is DohSettings) {
buffer.putUint8(199);
writeValue(buffer, value.encode());
} else if (value is DohSettings) {
} else if (value is GeckoEngineSettings) {
buffer.putUint8(200);
writeValue(buffer, value.encode());
} else if (value is GeckoEngineSettings) {
} else if (value is AutocompleteResult) {
buffer.putUint8(201);
writeValue(buffer, value.encode());
} else if (value is AutocompleteResult) {
} else if (value is UnknownHitResult) {
buffer.putUint8(202);
writeValue(buffer, value.encode());
} else if (value is UnknownHitResult) {
} else if (value is ImageHitResult) {
buffer.putUint8(203);
writeValue(buffer, value.encode());
} else if (value is ImageHitResult) {
} else if (value is VideoHitResult) {
buffer.putUint8(204);
writeValue(buffer, value.encode());
} else if (value is VideoHitResult) {
} else if (value is AudioHitResult) {
buffer.putUint8(205);
writeValue(buffer, value.encode());
} else if (value is AudioHitResult) {
} else if (value is ImageSrcHitResult) {
buffer.putUint8(206);
writeValue(buffer, value.encode());
} else if (value is ImageSrcHitResult) {
} else if (value is PhoneHitResult) {
buffer.putUint8(207);
writeValue(buffer, value.encode());
} else if (value is PhoneHitResult) {
} else if (value is EmailHitResult) {
buffer.putUint8(208);
writeValue(buffer, value.encode());
} else if (value is EmailHitResult) {
} else if (value is GeoHitResult) {
buffer.putUint8(209);
writeValue(buffer, value.encode());
} else if (value is GeoHitResult) {
} else if (value is DownloadState) {
buffer.putUint8(210);
writeValue(buffer, value.encode());
} else if (value is DownloadState) {
} else if (value is ShareInternetResourceState) {
buffer.putUint8(211);
writeValue(buffer, value.encode());
} else if (value is ShareInternetResourceState) {
} else if (value is AddonCollection) {
buffer.putUint8(212);
writeValue(buffer, value.encode());
} else if (value is AddonCollection) {
} else if (value is SyncEngineStatus) {
buffer.putUint8(213);
writeValue(buffer, value.encode());
} else if (value is SyncEngineStatus) {
} else if (value is SyncAccountInfo) {
buffer.putUint8(214);
writeValue(buffer, value.encode());
} else if (value is SyncAccountInfo) {
} else if (value is SyncDevice) {
buffer.putUint8(215);
writeValue(buffer, value.encode());
} else if (value is SyncDevice) {
} else if (value is SyncIncomingTab) {
buffer.putUint8(216);
writeValue(buffer, value.encode());
} else if (value is SyncIncomingTab) {
} else if (value is SyncRemoteTab) {
buffer.putUint8(217);
writeValue(buffer, value.encode());
} else if (value is SyncRemoteTab) {
} else if (value is SyncDeviceTabs) {
buffer.putUint8(218);
writeValue(buffer, value.encode());
} else if (value is SyncDeviceTabs) {
} else if (value is GeckoPref) {
buffer.putUint8(219);
writeValue(buffer, value.encode());
} else if (value is GeckoPref) {
} else if (value is MlProgressData) {
buffer.putUint8(220);
writeValue(buffer, value.encode());
} else if (value is MlProgressData) {
} else if (value is ContainerSiteAssignment) {
buffer.putUint8(221);
writeValue(buffer, value.encode());
} else if (value is ContainerSiteAssignment) {
} else if (value is GeckoHeader) {
buffer.putUint8(222);
writeValue(buffer, value.encode());
} else if (value is GeckoHeader) {
} else if (value is GeckoFetchRequest) {
buffer.putUint8(223);
writeValue(buffer, value.encode());
} else if (value is GeckoFetchRequest) {
} else if (value is GeckoFetchResponse) {
buffer.putUint8(224);
writeValue(buffer, value.encode());
} else if (value is GeckoFetchResponse) {
} else if (value is BookmarkNode) {
buffer.putUint8(225);
writeValue(buffer, value.encode());
} else if (value is BookmarkNode) {
} else if (value is BookmarkInfo) {
buffer.putUint8(226);
writeValue(buffer, value.encode());
} else if (value is BookmarkInfo) {
} else if (value is SitePermissions) {
buffer.putUint8(227);
writeValue(buffer, value.encode());
} else if (value is SitePermissions) {
} else if (value is TrackingProtectionException) {
buffer.putUint8(228);
writeValue(buffer, value.encode());
} else if (value is TrackingProtectionException) {
} else if (value is PwaIcon) {
buffer.putUint8(229);
writeValue(buffer, value.encode());
} else if (value is PwaIcon) {
} else if (value is ShareTargetFiles) {
buffer.putUint8(230);
writeValue(buffer, value.encode());
} else if (value is ShareTargetFiles) {
} else if (value is ShareTargetParams) {
buffer.putUint8(231);
writeValue(buffer, value.encode());
} else if (value is ShareTargetParams) {
} else if (value is ShareTarget) {
buffer.putUint8(232);
writeValue(buffer, value.encode());
} else if (value is ShareTarget) {
} else if (value is ExternalApplicationResource) {
buffer.putUint8(233);
writeValue(buffer, value.encode());
} else if (value is ExternalApplicationResource) {
buffer.putUint8(234);
writeValue(buffer, value.encode());
} else if (value is PwaManifest) {
buffer.putUint8(235);
buffer.putUint8(234);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
@@ -5503,120 +5451,118 @@ class _PigeonCodec extends StandardMessageCodec {
case 177:
return RecoverableTab.decode(readValue(buffer)!);
case 178:
return RecoverableBrowserState.decode(readValue(buffer)!);
case 179:
return IconRequest.decode(readValue(buffer)!);
case 180:
case 179:
return ResourceSize.decode(readValue(buffer)!);
case 181:
case 180:
return Resource.decode(readValue(buffer)!);
case 182:
case 181:
return IconResult.decode(readValue(buffer)!);
case 183:
case 182:
return CookiePartitionKey.decode(readValue(buffer)!);
case 184:
case 183:
return Cookie.decode(readValue(buffer)!);
case 185:
case 184:
return VisitInfo.decode(readValue(buffer)!);
case 186:
case 185:
return HistoryHighlightWeights.decode(readValue(buffer)!);
case 187:
case 186:
return HistoryHighlight.decode(readValue(buffer)!);
case 188:
case 187:
return TopFrecentSiteInfo.decode(readValue(buffer)!);
case 189:
case 188:
return HistoryItem.decode(readValue(buffer)!);
case 190:
case 189:
return HistoryState.decode(readValue(buffer)!);
case 191:
case 190:
return ReaderableState.decode(readValue(buffer)!);
case 192:
case 191:
return SecurityInfoState.decode(readValue(buffer)!);
case 193:
case 192:
return TabContentState.decode(readValue(buffer)!);
case 194:
case 193:
return FindResultState.decode(readValue(buffer)!);
case 195:
case 194:
return CustomSelectionAction.decode(readValue(buffer)!);
case 196:
case 195:
return WebExtensionData.decode(readValue(buffer)!);
case 197:
case 196:
return GeckoSuggestion.decode(readValue(buffer)!);
case 198:
case 197:
return TabContent.decode(readValue(buffer)!);
case 199:
case 198:
return ContentBlocking.decode(readValue(buffer)!);
case 200:
case 199:
return DohSettings.decode(readValue(buffer)!);
case 201:
case 200:
return GeckoEngineSettings.decode(readValue(buffer)!);
case 202:
case 201:
return AutocompleteResult.decode(readValue(buffer)!);
case 203:
case 202:
return UnknownHitResult.decode(readValue(buffer)!);
case 204:
case 203:
return ImageHitResult.decode(readValue(buffer)!);
case 205:
case 204:
return VideoHitResult.decode(readValue(buffer)!);
case 206:
case 205:
return AudioHitResult.decode(readValue(buffer)!);
case 207:
case 206:
return ImageSrcHitResult.decode(readValue(buffer)!);
case 208:
case 207:
return PhoneHitResult.decode(readValue(buffer)!);
case 209:
case 208:
return EmailHitResult.decode(readValue(buffer)!);
case 210:
case 209:
return GeoHitResult.decode(readValue(buffer)!);
case 211:
case 210:
return DownloadState.decode(readValue(buffer)!);
case 212:
case 211:
return ShareInternetResourceState.decode(readValue(buffer)!);
case 213:
case 212:
return AddonCollection.decode(readValue(buffer)!);
case 214:
case 213:
return SyncEngineStatus.decode(readValue(buffer)!);
case 215:
case 214:
return SyncAccountInfo.decode(readValue(buffer)!);
case 216:
case 215:
return SyncDevice.decode(readValue(buffer)!);
case 217:
case 216:
return SyncIncomingTab.decode(readValue(buffer)!);
case 218:
case 217:
return SyncRemoteTab.decode(readValue(buffer)!);
case 219:
case 218:
return SyncDeviceTabs.decode(readValue(buffer)!);
case 220:
case 219:
return GeckoPref.decode(readValue(buffer)!);
case 221:
case 220:
return MlProgressData.decode(readValue(buffer)!);
case 222:
case 221:
return ContainerSiteAssignment.decode(readValue(buffer)!);
case 223:
case 222:
return GeckoHeader.decode(readValue(buffer)!);
case 224:
case 223:
return GeckoFetchRequest.decode(readValue(buffer)!);
case 225:
case 224:
return GeckoFetchResponse.decode(readValue(buffer)!);
case 226:
case 225:
return BookmarkNode.decode(readValue(buffer)!);
case 227:
case 226:
return BookmarkInfo.decode(readValue(buffer)!);
case 228:
case 227:
return SitePermissions.decode(readValue(buffer)!);
case 229:
case 228:
return TrackingProtectionException.decode(readValue(buffer)!);
case 230:
case 229:
return PwaIcon.decode(readValue(buffer)!);
case 231:
case 230:
return ShareTargetFiles.decode(readValue(buffer)!);
case 232:
case 231:
return ShareTargetParams.decode(readValue(buffer)!);
case 233:
case 232:
return ShareTarget.decode(readValue(buffer)!);
case 234:
case 233:
return ExternalApplicationResource.decode(readValue(buffer)!);
case 235:
case 234:
return PwaManifest.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
@@ -6033,14 +5979,14 @@ class GeckoSyncApi {
}
}
Future<bool> sendTabToDevice(String deviceId, String title, String url) async {
Future<bool> sendTabToDevice(String deviceId, String title, String url, bool private) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_mozilla_components.GeckoSyncApi.sendTabToDevice$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[deviceId, title, url]);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[deviceId, title, url, private]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
@@ -7038,28 +6984,6 @@ class GeckoTabsApi {
}
}
Future<void> restoreTabsByBrowserState({required RecoverableBrowserState state, required RestoreLocation restoreLocation}) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_mozilla_components.GeckoTabsApi.restoreTabsByBrowserState$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[state, restoreLocation]);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
/// Selects an already existing tab with the matching [HistoryMetadataKey] or otherwise
/// creates a new tab with the given [url].
Future<String> selectOrAddTabByHistory({required String url, required HistoryMetadataKey historyMetadata}) async {
@@ -314,17 +314,6 @@ class RecoverableTab {
const RecoverableTab({this.engineSessionStateJson, required this.state});
}
/// A restored browser state, read from disk.
class RecoverableBrowserState {
/// The list of restored tabs.
final List<RecoverableTab?> tabs;
/// The ID of the selected tab in [tabs]. Or `null` if no selection was restored.
final String? selectedTabId;
const RecoverableBrowserState({required this.tabs, this.selectedTabId});
}
/// Indicates what location the tabs should be restored at
enum RestoreLocation {
/// Restore tabs at the beginning of the tab list
@@ -1266,7 +1255,7 @@ abstract class GeckoSyncApi {
List<SyncDevice> getDevices();
@async
bool sendTabToDevice(String deviceId, String title, String url);
bool sendTabToDevice(String deviceId, String title, String url, bool private);
@async
void refreshDevices();
@@ -1447,10 +1436,6 @@ abstract class GeckoTabsApi {
required String? selectTabId,
required RestoreLocation restoreLocation,
});
void restoreTabsByBrowserState({
required RecoverableBrowserState state,
required RestoreLocation restoreLocation,
});
//The calls with engin storage for restore are not supported at the moment
//selectOrAddTab invokes splitted
@@ -2486,5 +2471,10 @@ abstract class GeckoPwaApi {
/// The [overrideShortcutName] allows customizing the shortcut label.
/// Returns true if the shortcut was created successfully.
@async
bool installBasicShortcut(String? tabId, String profileUuid, String? contextId, String? overrideShortcutName);
bool installBasicShortcut(
String? tabId,
String profileUuid,
String? contextId,
String? overrideShortcutName,
);
}