From aeb97b1cb5ff38d564a911501ad2f43abcda27e4 Mon Sep 17 00:00:00 2001 From: mcarare Date: Thu, 26 May 2022 18:55:47 +0300 Subject: [PATCH 1/5] For #12233: Handle ERROR_BAD_HSTS_CERT error. --- .../engine/gecko/GeckoEngineSession.kt | 1 + .../engine/gecko/GeckoEngineSessionTest.kt | 4 +++ .../src/main/assets/errorPageScripts.js | 20 +++++++++++++ .../browser/errorpages/ErrorPages.kt | 28 ++++++++++++++++--- .../src/main/res/values/strings.xml | 20 +++++++++++++ .../browser/errorpages/ErrorPagesTest.kt | 1 + 6 files changed, 70 insertions(+), 4 deletions(-) diff --git a/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt b/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt index 7c9cd7ba65a..fd07755bfc0 100644 --- a/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt +++ b/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineSession.kt @@ -1144,6 +1144,7 @@ class GeckoEngineSession( WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI -> ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI -> ErrorType.ERROR_SAFEBROWSING_PHISHING_URI WebRequestError.ERROR_HTTPS_ONLY -> ErrorType.ERROR_HTTPS_ONLY + WebRequestError.ERROR_BAD_HSTS_CERT -> ErrorType.ERROR_BAD_HSTS_CERT else -> ErrorType.UNKNOWN } } diff --git a/components/browser/engine-gecko/src/test/java/mozilla/components/browser/engine/gecko/GeckoEngineSessionTest.kt b/components/browser/engine-gecko/src/test/java/mozilla/components/browser/engine/gecko/GeckoEngineSessionTest.kt index e7c43a3c990..1eb03fc1286 100644 --- a/components/browser/engine-gecko/src/test/java/mozilla/components/browser/engine/gecko/GeckoEngineSessionTest.kt +++ b/components/browser/engine-gecko/src/test/java/mozilla/components/browser/engine/gecko/GeckoEngineSessionTest.kt @@ -1963,6 +1963,10 @@ class GeckoEngineSessionTest { ErrorType.ERROR_HTTPS_ONLY, GeckoEngineSession.geckoErrorToErrorType(WebRequestError.ERROR_HTTPS_ONLY) ) + assertEquals( + ErrorType.ERROR_BAD_HSTS_CERT, + GeckoEngineSession.geckoErrorToErrorType(WebRequestError.ERROR_BAD_HSTS_CERT) + ) } @Test diff --git a/components/browser/errorpages/src/main/assets/errorPageScripts.js b/components/browser/errorpages/src/main/assets/errorPageScripts.js index 6d8b0a76eb0..7483b33ec08 100644 --- a/components/browser/errorpages/src/main/assets/errorPageScripts.js +++ b/components/browser/errorpages/src/main/assets/errorPageScripts.js @@ -12,6 +12,7 @@ function parseQuery(queryString) { const query = Object.fromEntries(new URLSearchParams(queryString).entries()); injectValues(query) updateShowSSL(query) + updateShowHSTS(query) }; /** @@ -32,6 +33,7 @@ function injectValues(queryMap) { document.getElementById('badCertTechnicalInfo').innerHTML = queryMap.badCertTechInfo document.getElementById('advancedPanelBackButton').innerHTML = queryMap.badCertGoBack document.getElementById('advancedPanelAcceptButton').innerHTML = queryMap.badCertAcceptTemporary + document.getElementById('advancedPanelAcceptButton').s = queryMap.badCertAcceptTemporary // If no image is passed in, remove the element so as not to leave an empty iframe const errorImage = document.getElementById('errorImage'); @@ -69,6 +71,24 @@ function updateShowSSL(queryMap) { } } +/** + * Used to show or hide the "advanced" button based for the HSTS error page + */ +function updateShowHSTS(queryMap) { + /** @type {'true' | 'false'} */ + const showHSTS = queryMap.showHSTS; + if (typeof document.addCertException === "undefined") { + document.getElementById('advancedButton').style.display='none'; + } else { + if (showHSTS === 'true') { + document.getElementById('advancedButton').style.display='block'; + document.getElementById('advancedPanelAcceptButton').style.display='none'; + } else { + document.getElementById('advancedButton').style.display='none'; + } + } +} + /** * Used to display information about the SSL certificate in `error_pages.html` */ diff --git a/components/browser/errorpages/src/main/java/mozilla/components/browser/errorpages/ErrorPages.kt b/components/browser/errorpages/src/main/java/mozilla/components/browser/errorpages/ErrorPages.kt index 9ee807e174e..01a6c8c1247 100644 --- a/components/browser/errorpages/src/main/java/mozilla/components/browser/errorpages/ErrorPages.kt +++ b/components/browser/errorpages/src/main/java/mozilla/components/browser/errorpages/ErrorPages.kt @@ -39,10 +39,19 @@ object ErrorPages { val imageName = if (errorType.imageNameRes != null) context.getString(errorType.imageNameRes) + ".svg" else "" val continueHttpButton = context.getString(R.string.mozac_browser_errorpages_httpsonly_button) val badCertAdvanced = context.getString(R.string.mozac_browser_errorpages_security_bad_cert_advanced) - val badCertTechInfo = context.getString( - R.string.mozac_browser_errorpages_security_bad_cert_techInfo, - context.appName, uri.toString() - ) + val badCertTechInfo = when (errorType) { + ErrorType.ERROR_SECURITY_BAD_CERT -> + context.getString( + R.string.mozac_browser_errorpages_security_bad_cert_techInfo, + context.appName, uri.toString() + ) + ErrorType.ERROR_BAD_HSTS_CERT -> context.getString( + R.string.mozac_browser_errorpages_security_bad_hsts_cert_techInfo, + uri.toString().trim('/'), context.appName + ) + else -> "" + } + val badCertGoBack = context.getString(R.string.mozac_browser_errorpages_security_bad_cert_back) val badCertAcceptTemporary = context.getString( R.string.mozac_browser_errorpages_security_bad_cert_accept_temporary @@ -53,6 +62,11 @@ object ErrorPages { else -> false }.toString() + val showHSTSAdvanced: String = when (errorType) { + ErrorType.ERROR_BAD_HSTS_CERT -> true + else -> false + }.toString() + val showContinueHttp: String = (errorType == ErrorType.ERROR_HTTPS_ONLY).toString() /** @@ -65,6 +79,7 @@ object ErrorPages { "&description=${description.urlEncode()}" + "&image=${imageName.urlEncode()}" + "&showSSL=${showSSLAdvanced.urlEncode()}" + + "&showHSTS=${showHSTSAdvanced.urlEncode()}" + "&badCertAdvanced=${badCertAdvanced.urlEncode()}" + "&badCertTechInfo=${badCertTechInfo.urlEncode()}" + "&badCertGoBack=${badCertGoBack.urlEncode()}" + @@ -222,5 +237,10 @@ enum class ErrorType( R.string.mozac_browser_errorpages_httpsonly_title, R.string.mozac_browser_errorpages_httpsonly_message, imageNameRes = R.string.mozac_error_lock + ), + ERROR_BAD_HSTS_CERT( + R.string.mozac_browser_errorpages_security_bad_hsts_cert_title, + R.string.mozac_browser_errorpages_security_bad_hsts_cert_message, + imageNameRes = R.string.mozac_error_lock ) } diff --git a/components/browser/errorpages/src/main/res/values/strings.xml b/components/browser/errorpages/src/main/res/values/strings.xml index d0dbda8e6a6..505c4d4b79d 100644 --- a/components/browser/errorpages/src/main/res/values/strings.xml +++ b/components/browser/errorpages/src/main/res/values/strings.xml @@ -46,6 +46,26 @@ Accept the Risk and Continue + + This website requires a secure connection. + + +
  • The page you are trying to view cannot be shown because this website requires a secure connection.
  • +
  • The issue is most likely with the website, and there is nothing you can do to resolve it.
  • +
  • You can notify the website’s administrator about the problem.
  • + + ]]>
    + + + Advanced… + + %1$s has a security policy called HTTP Strict Transport Security (HSTS), which means that %2$s can only connect to it securely. You can’t add an exception to visit this site. + ]]> + + Go Back + The connection was interrupted diff --git a/components/browser/errorpages/src/test/java/mozilla/components/browser/errorpages/ErrorPagesTest.kt b/components/browser/errorpages/src/test/java/mozilla/components/browser/errorpages/ErrorPagesTest.kt index 4dabccbfccc..d5354587e75 100644 --- a/components/browser/errorpages/src/test/java/mozilla/components/browser/errorpages/ErrorPagesTest.kt +++ b/components/browser/errorpages/src/test/java/mozilla/components/browser/errorpages/ErrorPagesTest.kt @@ -75,6 +75,7 @@ class ErrorPagesTest { assertUrlEncodingIsValid(ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI) assertUrlEncodingIsValid(ErrorType.ERROR_SAFEBROWSING_PHISHING_URI) assertUrlEncodingIsValid(ErrorType.ERROR_HTTPS_ONLY) + assertUrlEncodingIsValid(ErrorType.ERROR_BAD_HSTS_CERT) } private fun assertUrlEncodingIsValid(errorType: ErrorType) { From 576d19325bcc8ccd4849a8348b3de5577e5da510 Mon Sep 17 00:00:00 2001 From: MickeyMoz Date: Wed, 15 Jun 2022 13:43:30 +0000 Subject: [PATCH 2/5] Update GeckoView (Nightly) to 103.0.20220615093700. --- buildSrc/src/main/java/Gecko.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/Gecko.kt b/buildSrc/src/main/java/Gecko.kt index 660ff25cf94..054b088f495 100644 --- a/buildSrc/src/main/java/Gecko.kt +++ b/buildSrc/src/main/java/Gecko.kt @@ -9,7 +9,7 @@ object Gecko { /** * GeckoView Version. */ - const val version = "103.0.20220614082301" + const val version = "103.0.20220615093700" /** * GeckoView channel From a76c3fcd47ba12f59df80a351c7ac26c2e420a1e Mon Sep 17 00:00:00 2001 From: Jonathan Almeida Date: Mon, 13 Jun 2022 14:38:35 -0400 Subject: [PATCH 3/5] Issue #12230: Speculative fix for test failures in PromptFeatureTest --- .../mozilla/components/support/test/rule/MainCoroutineRule.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/support/test/src/main/java/mozilla/components/support/test/rule/MainCoroutineRule.kt b/components/support/test/src/main/java/mozilla/components/support/test/rule/MainCoroutineRule.kt index 27fc6d0b67d..bba97a1cafe 100644 --- a/components/support/test/src/main/java/mozilla/components/support/test/rule/MainCoroutineRule.kt +++ b/components/support/test/src/main/java/mozilla/components/support/test/rule/MainCoroutineRule.kt @@ -45,12 +45,12 @@ class MainCoroutineRule(val testDispatcher: TestDispatcher = UnconfinedTestDispa val scope by lazy { TestScope(testDispatcher) } override fun starting(description: Description) { - super.starting(description) Dispatchers.setMain(testDispatcher) + super.starting(description) } override fun finished(description: Description) { - super.finished(description) Dispatchers.resetMain() + super.finished(description) } } From bae083e649734ce1a96bf8ed2ab8456157774652 Mon Sep 17 00:00:00 2001 From: Alexandru2909 Date: Tue, 31 May 2022 17:27:26 +0300 Subject: [PATCH 4/5] For #12257 - Add LoginDelegate and CreditCardDelegate to replace PromptFeature parameters --- .../feature/prompts/PromptFeature.kt | 79 +++++++----------- .../prompts/creditcard/CreditCardDelegate.kt | 34 ++++++++ .../feature/prompts/login/LoginDelegate.kt | 27 +++++++ .../feature/prompts/PromptFeatureTest.kt | 81 +++++++++++++++---- docs/changelog.md | 1 + 5 files changed, 160 insertions(+), 62 deletions(-) create mode 100644 components/feature/prompts/src/main/java/mozilla/components/feature/prompts/creditcard/CreditCardDelegate.kt create mode 100644 components/feature/prompts/src/main/java/mozilla/components/feature/prompts/login/LoginDelegate.kt diff --git a/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt index 39870bbea97..5ac032e113e 100644 --- a/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt +++ b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt @@ -43,13 +43,12 @@ import mozilla.components.concept.engine.prompt.PromptRequest.TextPrompt import mozilla.components.concept.engine.prompt.PromptRequest.TimeSelection import mozilla.components.concept.storage.CreditCardEntry import mozilla.components.concept.storage.CreditCardValidationDelegate -import mozilla.components.concept.storage.Login import mozilla.components.concept.storage.LoginEntry import mozilla.components.concept.storage.LoginValidationDelegate import mozilla.components.feature.prompts.address.AddressDelegate import mozilla.components.feature.prompts.address.AddressPicker import mozilla.components.feature.prompts.address.DefaultAddressDelegate -import mozilla.components.feature.prompts.concept.SelectablePromptView +import mozilla.components.feature.prompts.creditcard.CreditCardDelegate import mozilla.components.feature.prompts.creditcard.CreditCardPicker import mozilla.components.feature.prompts.creditcard.CreditCardSaveDialogFragment import mozilla.components.feature.prompts.dialog.AlertDialogFragment @@ -70,6 +69,7 @@ import mozilla.components.feature.prompts.dialog.TimePickerDialogFragment import mozilla.components.feature.prompts.facts.emitSuccessfulAddressAutofillFormDetectedFact import mozilla.components.feature.prompts.facts.emitSuccessfulCreditCardAutofillFormDetectedFact import mozilla.components.feature.prompts.file.FilePicker +import mozilla.components.feature.prompts.login.LoginDelegate import mozilla.components.feature.prompts.login.LoginExceptions import mozilla.components.feature.prompts.login.LoginPicker import mozilla.components.feature.prompts.share.DefaultShareDelegate @@ -126,16 +126,8 @@ internal const val FRAGMENT_TAG = "mozac_feature_prompt_dialog" * will be shown. * @property loginExceptionStorage An implementation of [LoginExceptions] that saves and checks origins * the user does not want to see a save login dialog for. - * @property loginPickerView The [SelectablePromptView] used for [LoginPicker] to display a - * selectable prompt list of login options. - * @property onManageLogins A callback invoked when a user selects "manage logins" from the - * select login prompt. - * @property creditCardPickerView The [SelectablePromptView] used for [CreditCardPicker] to display - * a selectable prompt list of credit card options. - * @property onManageCreditCards A callback invoked when a user selects "Manage credit cards" from - * the select credit card prompt. - * @property onSelectCreditCard A callback invoked when a user selects a credit card from the - * select credit card prompt. + * @property loginDelegate Delegate for login picker. + * @property creditCardDelegate Delegate for credit card picker. * @property addressDelegate Delegate for address picker. * @property onNeedToRequestPermissions A callback invoked when permissions * need to be requested before a prompt (e.g. a file picker) can be displayed. @@ -154,11 +146,8 @@ class PromptFeature private constructor( private val isCreditCardAutofillEnabled: () -> Boolean = { false }, private val isAddressAutofillEnabled: () -> Boolean = { false }, override val loginExceptionStorage: LoginExceptions? = null, - private val loginPickerView: SelectablePromptView? = null, - private val onManageLogins: () -> Unit = {}, - private val creditCardPickerView: SelectablePromptView? = null, - private val onManageCreditCards: () -> Unit = {}, - private val onSelectCreditCard: () -> Unit = {}, + private val loginDelegate: LoginDelegate = object : LoginDelegate {}, + private val creditCardDelegate: CreditCardDelegate = object : CreditCardDelegate {}, private val addressDelegate: AddressDelegate = DefaultAddressDelegate(), onNeedToRequestPermissions: OnNeedToRequestPermissions ) : LifecycleAwareFeature, @@ -195,11 +184,8 @@ class PromptFeature private constructor( isCreditCardAutofillEnabled: () -> Boolean = { false }, isAddressAutofillEnabled: () -> Boolean = { false }, loginExceptionStorage: LoginExceptions? = null, - loginPickerView: SelectablePromptView? = null, - onManageLogins: () -> Unit = {}, - creditCardPickerView: SelectablePromptView? = null, - onManageCreditCards: () -> Unit = {}, - onSelectCreditCard: () -> Unit = {}, + loginDelegate: LoginDelegate = object : LoginDelegate {}, + creditCardDelegate: CreditCardDelegate = object : CreditCardDelegate {}, addressDelegate: AddressDelegate = DefaultAddressDelegate(), onNeedToRequestPermissions: OnNeedToRequestPermissions ) : this( @@ -215,11 +201,8 @@ class PromptFeature private constructor( isAddressAutofillEnabled = isAddressAutofillEnabled, loginExceptionStorage = loginExceptionStorage, onNeedToRequestPermissions = onNeedToRequestPermissions, - loginPickerView = loginPickerView, - onManageLogins = onManageLogins, - creditCardPickerView = creditCardPickerView, - onManageCreditCards = onManageCreditCards, - onSelectCreditCard = onSelectCreditCard, + loginDelegate = loginDelegate, + creditCardDelegate = creditCardDelegate, addressDelegate = addressDelegate ) @@ -235,11 +218,8 @@ class PromptFeature private constructor( isCreditCardAutofillEnabled: () -> Boolean = { false }, isAddressAutofillEnabled: () -> Boolean = { false }, loginExceptionStorage: LoginExceptions? = null, - loginPickerView: SelectablePromptView? = null, - onManageLogins: () -> Unit = {}, - creditCardPickerView: SelectablePromptView? = null, - onManageCreditCards: () -> Unit = {}, - onSelectCreditCard: () -> Unit = {}, + loginDelegate: LoginDelegate = object : LoginDelegate {}, + creditCardDelegate: CreditCardDelegate = object : CreditCardDelegate {}, addressDelegate: AddressDelegate = DefaultAddressDelegate(), onNeedToRequestPermissions: OnNeedToRequestPermissions ) : this( @@ -255,11 +235,8 @@ class PromptFeature private constructor( isAddressAutofillEnabled = isAddressAutofillEnabled, loginExceptionStorage = loginExceptionStorage, onNeedToRequestPermissions = onNeedToRequestPermissions, - loginPickerView = loginPickerView, - onManageLogins = onManageLogins, - creditCardPickerView = creditCardPickerView, - onManageCreditCards = onManageCreditCards, - onSelectCreditCard = onSelectCreditCard, + loginDelegate = loginDelegate, + creditCardDelegate = creditCardDelegate, addressDelegate = addressDelegate ) @@ -267,18 +244,24 @@ class PromptFeature private constructor( @VisibleForTesting(otherwise = PRIVATE) internal var loginPicker = - loginPickerView?.let { LoginPicker(store, it, onManageLogins, customTabId) } + with(loginDelegate) { + loginPickerView?.let { + LoginPicker(store, it, onManageLogins, customTabId) + } + } @VisibleForTesting(otherwise = PRIVATE) internal var creditCardPicker = - creditCardPickerView?.let { - CreditCardPicker( - store = store, - creditCardSelectBar = it, - manageCreditCardsCallback = onManageCreditCards, - selectCreditCardCallback = onSelectCreditCard, - sessionId = customTabId - ) + with(creditCardDelegate) { + creditCardPickerView?.let { + CreditCardPicker( + store = store, + creditCardSelectBar = it, + manageCreditCardsCallback = onManageCreditCards, + selectCreditCardCallback = onSelectCreditCard, + sessionId = customTabId + ) + } } @VisibleForTesting(otherwise = PRIVATE) @@ -922,7 +905,7 @@ class PromptFeature private constructor( (activePromptRequest as? SelectLoginPrompt)?.let { selectLoginPrompt -> loginPicker?.let { loginPicker -> - if (loginPickerView?.asView()?.isVisible == true) { + if (loginDelegate.loginPickerView?.asView()?.isVisible == true) { loginPicker.dismissCurrentLoginSelect(selectLoginPrompt) result = true } @@ -931,7 +914,7 @@ class PromptFeature private constructor( (activePromptRequest as? SelectCreditCard)?.let { selectCreditCardPrompt -> creditCardPicker?.let { creditCardPicker -> - if (creditCardPickerView?.asView()?.isVisible == true) { + if (creditCardDelegate.creditCardPickerView?.asView()?.isVisible == true) { creditCardPicker.dismissSelectCreditCardRequest(selectCreditCardPrompt) result = true } diff --git a/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/creditcard/CreditCardDelegate.kt b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/creditcard/CreditCardDelegate.kt new file mode 100644 index 00000000000..9723d0d521a --- /dev/null +++ b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/creditcard/CreditCardDelegate.kt @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package mozilla.components.feature.prompts.creditcard + +import mozilla.components.concept.storage.CreditCardEntry +import mozilla.components.feature.prompts.concept.SelectablePromptView + +/** + * Delegate for credit card picker and related callbacks + */ +interface CreditCardDelegate { + /** + * The [SelectablePromptView] used for [CreditCardPicker] to display a + * selectable prompt list of credit cards. + */ + val creditCardPickerView: SelectablePromptView? + get() = null + + /** + * Callback invoked when a user selects "Manage credit cards" + * from the select credit card prompt. + */ + val onManageCreditCards: () -> Unit + get() = {} + + /** + * Callback invoked when a user selects a credit card option + * from the select credit card prompt + */ + val onSelectCreditCard: () -> Unit + get() = {} +} diff --git a/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/login/LoginDelegate.kt b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/login/LoginDelegate.kt new file mode 100644 index 00000000000..80f4d332972 --- /dev/null +++ b/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/login/LoginDelegate.kt @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package mozilla.components.feature.prompts.login + +import mozilla.components.concept.storage.Login +import mozilla.components.feature.prompts.concept.SelectablePromptView + +/** + * Delegate to display the login select prompt and related callbacks + */ +interface LoginDelegate { + /** + * The [SelectablePromptView] used for [LoginPicker] to display a + * selectable prompt list of logins. + */ + val loginPickerView: SelectablePromptView? + get() = null + + /** + * Callback invoked when a user selects "Manage logins" + * from the select login prompt. + */ + val onManageLogins: () -> Unit + get() = {} +} diff --git a/components/feature/prompts/src/test/java/mozilla/components/feature/prompts/PromptFeatureTest.kt b/components/feature/prompts/src/test/java/mozilla/components/feature/prompts/PromptFeatureTest.kt index 094e93eb286..98b18cb4931 100644 --- a/components/feature/prompts/src/test/java/mozilla/components/feature/prompts/PromptFeatureTest.kt +++ b/components/feature/prompts/src/test/java/mozilla/components/feature/prompts/PromptFeatureTest.kt @@ -45,6 +45,7 @@ import mozilla.components.concept.storage.LoginEntry import mozilla.components.feature.prompts.address.AddressDelegate import mozilla.components.feature.prompts.address.AddressPicker import mozilla.components.feature.prompts.concept.SelectablePromptView +import mozilla.components.feature.prompts.creditcard.CreditCardDelegate import mozilla.components.feature.prompts.creditcard.CreditCardPicker import mozilla.components.feature.prompts.creditcard.CreditCardSaveDialogFragment import mozilla.components.feature.prompts.dialog.ChoiceDialogFragment @@ -53,6 +54,7 @@ import mozilla.components.feature.prompts.dialog.MultiButtonDialogFragment import mozilla.components.feature.prompts.dialog.PromptDialogFragment import mozilla.components.feature.prompts.dialog.SaveLoginDialogFragment import mozilla.components.feature.prompts.file.FilePicker.Companion.FILE_PICKER_ACTIVITY_REQUEST_CODE +import mozilla.components.feature.prompts.login.LoginDelegate import mozilla.components.feature.prompts.login.LoginPicker import mozilla.components.feature.prompts.share.ShareDelegate import mozilla.components.support.test.any @@ -277,7 +279,10 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - loginPickerView = loginPickerView + loginDelegate = object : LoginDelegate { + override val loginPickerView = loginPickerView + override val onManageLogins = {} + } ) { } ) val selectLoginPrompt = mock() @@ -430,7 +435,10 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - loginPickerView = loginPickerView + loginDelegate = object : LoginDelegate { + override val loginPickerView = loginPickerView + override val onManageLogins = {} + } ) { } ) val selectLoginPrompt = mock() @@ -455,7 +463,10 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - loginPickerView = loginPickerView + loginDelegate = object : LoginDelegate { + override val loginPickerView = loginPickerView + override val onManageLogins = {} + } ) { } ) val selectLoginPrompt = mock() @@ -480,7 +491,10 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - loginPickerView = loginPickerView + loginDelegate = object : LoginDelegate { + override val loginPickerView = loginPickerView + override val onManageLogins = {} + } ) { } ) val selectLoginPrompt = mock() @@ -506,7 +520,11 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + } ) { } ) val selectCreditCardRequest = mock() @@ -530,7 +548,11 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + } ) { } ) val selectCreditCardRequest = mock() @@ -553,7 +575,11 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + } ) { } ) val selectCreditCardRequest = mock() @@ -577,7 +603,11 @@ class PromptFeatureTest { mock(), store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + } ) { } ) feature.creditCardPicker = creditCardPicker @@ -971,7 +1001,11 @@ class PromptFeatureTest { activity = mock(), store = store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView, + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + }, isCreditCardAutofillEnabled = { true } ) { } feature.creditCardPicker = creditCardPicker @@ -990,7 +1024,11 @@ class PromptFeatureTest { activity = mock(), store = store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView, + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + }, isCreditCardAutofillEnabled = { true } ) { } feature.creditCardPicker = creditCardPicker @@ -1009,7 +1047,11 @@ class PromptFeatureTest { activity = mock(), store = store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView, + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + }, isCreditCardAutofillEnabled = { true } ) { } feature.creditCardPicker = creditCardPicker @@ -1027,7 +1069,11 @@ class PromptFeatureTest { activity = mock(), store = store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView, + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + }, isCreditCardAutofillEnabled = { true } ) { } feature.creditCardPicker = creditCardPicker @@ -1514,7 +1560,10 @@ class PromptFeatureTest { val feature = PromptFeature( activity = mock(), store = store, fragmentManager = fragmentManager, - loginPickerView = loginPickerView + loginDelegate = object : LoginDelegate { + override val loginPickerView = loginPickerView + override val onManageLogins = {} + } ) { } feature.loginPicker = loginPicker val onLoginDismiss: () -> Unit = {} @@ -1547,7 +1596,11 @@ class PromptFeatureTest { activity = mock(), store = store, fragmentManager = fragmentManager, - creditCardPickerView = creditCardPickerView, + creditCardDelegate = object : CreditCardDelegate { + override val creditCardPickerView = creditCardPickerView + override val onSelectCreditCard = {} + override val onManageCreditCards = {} + }, isCreditCardAutofillEnabled = { true } ) { } feature.creditCardPicker = creditCardPicker diff --git a/docs/changelog.md b/docs/changelog.md index ef267639aa5..630aa780da4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -25,6 +25,7 @@ permalink: /changelog/ * **feature-prompts**: * Added optional `addressPickerView` and `onManageAddresses` parameters through `AddressDelegate` to `PromptFeature` for a new `AddressPicker` to display a view for selecting addresses to autofill into a site. [#12061](https://github.com/mozilla-mobile/android-components/issues/12061) + * ⚠️ **This is a breaking change**: `PromptFeature` constructor now takes `LoginDelegate` and `CreditCardDelegate` instead of login picker and credit card picker parameters. [#12257](https://github.com/mozilla-mobile/android-components/issues/12257) * **service-glean** * 🆙 Updated Glean to version 50.0.1 ([changelog](https://github.com/mozilla/glean/releases/tag/v50.0.1)) From d0a4c569a75d7c9d8ea1704c4bb85f604bdf0d00 Mon Sep 17 00:00:00 2001 From: Mozilla L10n Automation Bot Date: Thu, 16 Jun 2022 00:03:25 +0000 Subject: [PATCH 5/5] Import l10n. --- .../prompts/src/main/res/values-sat/strings.xml | 10 ++++++++++ .../feature/prompts/src/main/res/values-sl/strings.xml | 3 +++ 2 files changed, 13 insertions(+) diff --git a/components/feature/prompts/src/main/res/values-sat/strings.xml b/components/feature/prompts/src/main/res/values-sat/strings.xml index 0fea2bc0d3c..23173a30097 100644 --- a/components/feature/prompts/src/main/res/values-sat/strings.xml +++ b/components/feature/prompts/src/main/res/values-sat/strings.xml @@ -113,4 +113,14 @@ ᱠᱟᱰ ᱪᱟᱵᱟ ᱢᱟᱦᱟᱸ ᱦᱟᱹᱞᱤᱭᱟᱹᱭᱟᱹᱠ ᱟᱢ ᱥᱮ ? ᱠᱟᱰ ᱱᱚᱢᱵᱚᱨ ᱫᱚ ᱨᱩᱠᱷᱤᱭᱟᱹᱜᱼᱟ ᱾ ᱨᱩᱠᱷᱤᱭᱟᱹ ᱠᱳᱰ ᱫᱚ ᱵᱟᱝ ᱥᱟᱧᱪᱟᱣᱜᱼᱟ ᱾ + + + + ᱴᱷᱤᱠᱬᱟᱹ ᱢᱮᱴᱟᱣ ᱢᱮ + + ᱵᱟᱛᱟᱣᱟᱠᱟᱱ ᱞᱚᱜᱤᱱ ᱠᱚ ᱯᱟᱥᱱᱟᱣ ᱪᱷᱚᱭ ᱢᱮ + + ᱵᱟᱛᱟᱣᱟᱠᱟᱱ ᱞᱚᱜᱤᱱ ᱠᱚ ᱦᱚᱯᱚᱱ ᱪᱷᱚᱭ ᱢᱮ + + ᱴᱷᱤᱠᱬᱟᱹᱤᱭᱟᱹ ᱡᱚᱛᱚᱱ ᱮᱢ diff --git a/components/feature/prompts/src/main/res/values-sl/strings.xml b/components/feature/prompts/src/main/res/values-sl/strings.xml index 7d73d06255e..ae1a4ad81f7 100644 --- a/components/feature/prompts/src/main/res/values-sl/strings.xml +++ b/components/feature/prompts/src/main/res/values-sl/strings.xml @@ -114,6 +114,9 @@ Številka kartice bo šifrirana. Varnostna koda ne bo shranjena. + + + Izberite naslove Razširi predlagane naslove