update to gecko 150.0

This commit is contained in:
Fabian Freund
2026-04-29 20:56:07 +02:00
parent a7e3fa3bb7
commit 65686dce10
9 changed files with 60 additions and 5 deletions
@@ -3,7 +3,7 @@ version = "1.0-SNAPSHOT"
buildscript {
ext.kotlin_version = "2.3.10"
ext.mozillaComponentsVersion = '149.0'
ext.mozillaComponentsVersion = '150.0'
repositories {
google()
@@ -12,6 +12,7 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -64,6 +65,7 @@ import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.ktx.android.view.enterImmersiveMode
import mozilla.components.support.ktx.android.view.exitImmersiveMode
import mozilla.components.support.locale.ActivityContextWrapper
import mozilla.components.support.utils.DefaultDownloadFileUtils
import mozilla.components.support.webextensions.WebExtensionPopupObserver
/**
@@ -299,6 +301,12 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Activit
onDownloadStopped = { download, id, status ->
Logger.debug("Download done. ID#$id $download with status $status")
},
downloadFileUtils = DefaultDownloadFileUtils(
context = components.profileApplicationContext,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
downloadManager = FetchDownloadManager(
components.profileApplicationContext,
components.core.store,
@@ -8,6 +8,7 @@ package eu.weblibre.flutter_mozilla_components
import android.content.Intent
import android.os.Bundle
import android.os.Environment
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@@ -15,6 +16,7 @@ import android.widget.ImageButton
import android.widget.ImageView
import android.widget.PopupWindow
import androidx.annotation.CallSuper
import androidx.lifecycle.lifecycleScope
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.color.MaterialColors
import com.google.android.material.materialswitch.MaterialSwitch
@@ -88,10 +90,16 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
ContextMenuCandidate.createSaveImageCandidate(
requireContext(),
components.useCases.contextMenuUseCases,
downloadsLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
ContextMenuCandidate.createSaveVideoAudioCandidate(
requireContext(),
components.useCases.contextMenuUseCases,
downloadsLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
ContextMenuCandidate.createCopyImageLocationCandidate(requireContext(), view),
)
@@ -330,6 +338,7 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
customTabsStore = components.core.customTabsStore,
tabId = sessionId,
manifest = manifest,
scope = viewLifecycleOwner.lifecycleScope,
) { toolbarVisible ->
Logger.debug("Custom tab toolbar visibility: $toolbarVisible")
},
@@ -26,6 +26,7 @@ import mozilla.components.feature.downloads.manager.FetchDownloadManager
import mozilla.components.feature.prompts.PromptFeature
import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import mozilla.components.support.utils.DefaultDownloadFileUtils
/**
* Provides shared functionality to fragments for add-on popups and settings.
@@ -71,6 +72,12 @@ abstract class AddonPopupBaseFragment : Fragment(), EngineSession.Observer, User
useCases = components.useCases.downloadsUseCases,
fragmentManager = childFragmentManager,
tabId = it.id,
downloadFileUtils = DefaultDownloadFileUtils(
context = components.profileApplicationContext,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
downloadManager = FetchDownloadManager(
requireContext().applicationContext,
components.core.store,
@@ -322,7 +322,7 @@ class WebExtensionPromptFeature(
}
is WebExtensionInstallException.SoftBlocked -> {
context.getString(MozComp.string.mozac_feature_addons_soft_blocked_1, addonName)
context.getString(MozComp.string.mozac_feature_addons_soft_blocked_2, addonName)
}
is WebExtensionInstallException.UserCancelled -> {
@@ -58,7 +58,6 @@ class GeckoDownloadsApiImpl : GeckoDownloadsApi {
currentBytesCopied = currentBytesCopied ?: 0L,
status = status?.toMozillaStatus() ?: mozilla.components.browser.state.state.content.DownloadState.Status.INITIATED,
userAgent = userAgent,
destinationDirectory = destinationDirectory ?: Environment.DIRECTORY_DOWNLOADS,
directoryPath = directoryPath ?: Environment.getExternalStoragePublicDirectory(
destinationDirectory ?: Environment.DIRECTORY_DOWNLOADS
).path,
@@ -8,6 +8,7 @@ package eu.weblibre.flutter_mozilla_components.components
import android.content.Context
import android.content.SharedPreferences
import android.os.Environment
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import eu.weblibre.flutter_mozilla_components.Components
@@ -72,6 +73,7 @@ import mozilla.components.support.base.worker.Frequency
import org.mozilla.geckoview.GeckoRuntime
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.Job
import mozilla.components.support.utils.DefaultDownloadFileUtils
import java.util.concurrent.TimeUnit
private const val AMO_COLLECTION_MAX_CACHE_AGE = 24 * 60L
@@ -205,7 +207,17 @@ class Core(
middleware = listOf(
HistoryMetadataMiddleware(historyMetadataService),
FlutterEventMiddleware(flutterEvents),
DownloadMiddleware(context, DownloadService::class.java, { false }),
DownloadMiddleware(
applicationContext = context,
downloadServiceClass = DownloadService::class.java,
deleteFileFromStorage = { false },
downloadFileUtils = DefaultDownloadFileUtils(
context = context,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
),
ThumbnailsMiddleware(thumbnailStorage),
ReaderViewMiddleware(),
UndoMiddleware(),
@@ -5,6 +5,7 @@
package eu.weblibre.flutter_mozilla_components.components
import android.content.Context
import android.os.Environment
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.app.links.AppLinksUseCases
@@ -17,6 +18,7 @@ import mozilla.components.feature.pwa.WebAppShortcutManager
import mozilla.components.feature.pwa.WebAppUseCases
import mozilla.components.feature.tabs.CustomTabsUseCases
import mozilla.components.feature.tabs.TabsUseCases
import mozilla.components.support.utils.DefaultDownloadFileUtils
/**
* Component group for all use cases. Use cases are provided by feature
@@ -46,7 +48,17 @@ class UseCases(
/**
* Use cases related to the downloads feature.
*/
val downloadsUseCases: DownloadsUseCases by lazy { DownloadsUseCases(store, context) }
val downloadsUseCases: DownloadsUseCases by lazy {
DownloadsUseCases(
store = store,
downloadFileUtils = DefaultDownloadFileUtils(
context = context,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
)
}
/**
* Use cases related to the context menu feature.
@@ -14,6 +14,8 @@ 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.feature.downloads.filewriter.DefaultDownloadFileWriter
import mozilla.components.feature.downloads.filewriter.DownloadFileWriter
import mozilla.components.support.base.android.NotificationsDelegate
import mozilla.components.support.utils.DefaultDownloadFileUtils
import mozilla.components.support.utils.DownloadFileUtils
@@ -41,4 +43,10 @@ class DownloadService : AbstractFetchDownloadService() {
},
)
}
override val downloadFileWriter: DownloadFileWriter by lazy {
DefaultDownloadFileWriter(
context = applicationContext,
downloadFileUtils = downloadFileUtils,
)
}
}