Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class WebExtensionPromptFeature(
}

is WebExtensionInstallException.SoftBlocked -> {
context.getString(addonsR.string.mozac_feature_addons_soft_blocked_1, addonName, R.string.app_name)
context.getString(addonsR.string.mozac_feature_addons_soft_blocked_2, addonName, R.string.app_name)
}

is WebExtensionInstallException.UserCancelled -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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
Expand Down Expand Up @@ -44,6 +45,7 @@ import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
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.utils.DefaultDownloadFileUtils
import mozilla.components.ui.widgets.behavior.DependencyGravity
import mozilla.components.ui.widgets.behavior.EngineViewClippingBehavior
import mozilla.components.ui.widgets.behavior.EngineViewScrollingGesturesBehavior
Expand Down Expand Up @@ -242,6 +244,12 @@ abstract class BaseBrowserFragment :
store = requireComponents.core.store,
useCases = requireComponents.useCases.downloadsUseCases,
fragmentManager = childFragmentManager,
downloadFileUtils = DefaultDownloadFileUtils(
context = requireContext().applicationContext,
downloadLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
downloadManager = FetchDownloadManager(
requireContext().applicationContext,
requireComponents.core.store,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class BrowserFragment :
)
awesomeBar.setOnRemoveSuggestionButtonClicked {
awesomeBar.addHiddenSuggestion(it)
deleteHistorySuggestion(it.suggestion)
(it.suggestion as? Suggestion)?.let { s -> deleteHistorySuggestion(s) }
}

TabsToolbarFeature(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.reference.browser.browser

import android.content.Context
import android.os.Environment
import android.view.View
import androidx.fragment.app.FragmentManager
import mozilla.components.browser.state.store.BrowserStore
Expand Down Expand Up @@ -39,11 +40,25 @@ class ContextMenuIntegration(
createCopyLinkCandidate(context, parentView, snackbarDelegate),
createShareLinkCandidate(context),
createOpenImageInNewTabCandidate(context, tabsUseCases, parentView, snackbarDelegate),
createSaveImageCandidate(context, contextMenuUseCases),
createSaveImageCandidate(
context,
contextMenuUseCases,
downloadsLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
),
createCopyImageLocationCandidate(context, parentView, snackbarDelegate),
)
} else {
ContextMenuCandidate.defaultCandidates(context, tabsUseCases, contextMenuUseCases, parentView)
ContextMenuCandidate.defaultCandidates(
context,
tabsUseCases,
contextMenuUseCases,
parentView,
downloadsLocation = {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path
},
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package org.mozilla.reference.browser.components

import android.content.Context
import android.content.SharedPreferences
import android.os.Environment
import androidx.preference.PreferenceManager
import mozilla.components.browser.engine.gecko.permission.GeckoSitePermissionsStorage
import mozilla.components.browser.icons.BrowserIcons
Expand Down Expand Up @@ -43,6 +44,7 @@ import mozilla.components.lib.dataprotect.SecureAbove22Preferences
import mozilla.components.service.location.LocationService
import mozilla.components.service.sync.logins.SyncableLoginsStorage
import mozilla.components.support.base.worker.Frequency
import mozilla.components.support.utils.DefaultDownloadFileUtils
import org.mozilla.reference.browser.AppRequestInterceptor
import org.mozilla.reference.browser.BrowserActivity
import org.mozilla.reference.browser.EngineProvider
Expand Down Expand Up @@ -100,7 +102,17 @@ class Core(
val store by lazy {
BrowserStore(
middleware = listOf(
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(),
RegionMiddleware(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.reference.browser.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.contextmenu.ContextMenuUseCases
Expand All @@ -16,6 +17,7 @@ import mozilla.components.feature.session.SessionUseCases
import mozilla.components.feature.session.SettingsUseCases
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
Expand Down Expand Up @@ -62,7 +64,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 Custom Tabs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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
Expand All @@ -30,5 +32,11 @@ class DownloadService : AbstractFetchDownloadService() {
},
)
}
override val downloadFileWriter: DownloadFileWriter by lazy {
DefaultDownloadFileWriter(
context = applicationContext,
downloadFileUtils = downloadFileUtils,
)
}
override val packageNameProvider: PackageNameProvider by lazy { DefaultPackageNameProvider(applicationContext) }
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# Android Components
android-components = "149.0.20260223091613"
android-components = "150.0.20260226092447"

# AGP
android-gradle-plugin = "9.0.0"
Expand Down