Skip to content

Commit 9ca1df9

Browse files
committed
Add new feature flag canIntegrateWebMessageBasedAutofillInWebView
1 parent 676e4c1 commit 9ca1df9

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

autofill/autofill-api/src/main/java/com/duckduckgo/autofill/api/AutofillFeature.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ interface AutofillFeature {
3333
/**
3434
* Kill switch for if we should inject Autofill javascript into the browser.
3535
*
36-
* @return `true` when the remote config has the global "canIntegrateAutofillInWebView" autofill sub-feature flag enabled
36+
* @return `true` when the remote config has the global "canIntegrateWebMessageBasedAutofillInWebView" autofill sub-feature flag enabled
3737
* If the remote feature is not present defaults to `true`
3838
*/
3939
@Toggle.DefaultValue(true)
40-
fun canIntegrateAutofillInWebView(): Toggle
40+
fun canIntegrateWebMessageBasedAutofillInWebView(): Toggle
4141

4242
/**
4343
* @return `true` when the remote config has the global "canInjectCredentials" autofill sub-feature flag enabled

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/AutofillGlobalCapabilityChecker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AutofillGlobalCapabilityCheckerImpl @Inject constructor(
5555
override suspend fun isAutofillEnabledByConfiguration(url: String): Boolean {
5656
return withContext(dispatcherProvider.io()) {
5757
val enabledAtTopLevel = isInternalTester() || isGlobalFeatureEnabled()
58-
val canIntegrateAutofill = autofillFeature.canIntegrateAutofillInWebView().isEnabled()
58+
val canIntegrateAutofill = autofillFeature.canIntegrateWebMessageBasedAutofillInWebView().isEnabled()
5959
enabledAtTopLevel && canIntegrateAutofill && !isAnException(url)
6060
}
6161
}

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/InlineBrowserAutofill.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ class AutofillWebMessageAttacherImpl @Inject constructor(
118118
private val safeWebMessageHandler: SafeWebMessageHandler,
119119
) : AutofillWebMessageAttacher {
120120

121-
@SuppressLint("AddWebMessageListenerUsage")
122-
// suppress AddWebMessageListenerUsage, we don't have access to DuckDuckGoWebView here.
123121
override suspend fun addListener(
124122
webView: WebView,
125123
listener: AutofillWebMessageListener,

autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/AutofillGlobalCapabilityCheckerImplGlobalFeatureTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class AutofillGlobalCapabilityCheckerImplGlobalFeatureTest(
230230
private fun configureCanIntegrateAutofillSubfeature(isEnabled: Boolean) {
231231
val toggle: Toggle = mock()
232232
whenever(toggle.isEnabled()).thenReturn(isEnabled)
233-
whenever(autofillFeature.canIntegrateAutofillInWebView()).thenReturn(toggle)
233+
whenever(autofillFeature.canIntegrateWebMessageBasedAutofillInWebView()).thenReturn(toggle)
234234
}
235235

236236
private fun configureIfUrlIsException(isException: Boolean) {

autofill/autofill-impl/src/test/java/com/duckduckgo/autofill/impl/InlineBrowserAutofillTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class InlineBrowserAutofillTest {
9595
canSaveCredentials: Boolean = true,
9696
canGeneratePassword: Boolean = true,
9797
canAccessCredentialManagement: Boolean = true,
98-
canIntegrateAutofillInWebView: Boolean = true,
98+
canIntegrateWebMessageBasedAutofillInWebView: Boolean = true,
9999
deviceWebViewSupportsAutofill: Boolean = true,
100100
): InlineBrowserAutofill {
101101
val autofillFeature = FakeFeatureToggleFactory.create(AutofillFeature::class.java)
@@ -104,10 +104,10 @@ class InlineBrowserAutofillTest {
104104
autofillFeature.canSaveCredentials().setRawStoredState(State(enable = canSaveCredentials))
105105
autofillFeature.canGeneratePasswords().setRawStoredState(State(enable = canGeneratePassword))
106106
autofillFeature.canAccessCredentialManagement().setRawStoredState(State(enable = canAccessCredentialManagement))
107-
autofillFeature.canIntegrateAutofillInWebView().setRawStoredState(State(enable = canIntegrateAutofillInWebView))
107+
autofillFeature.canIntegrateWebMessageBasedAutofillInWebView().setRawStoredState(State(enable = canIntegrateWebMessageBasedAutofillInWebView))
108108

109109
whenever(capabilityChecker.webViewSupportsAutofill()).thenReturn(deviceWebViewSupportsAutofill)
110-
whenever(capabilityChecker.canInjectCredentialsToWebView(any())).thenReturn(canIntegrateAutofillInWebView)
110+
whenever(capabilityChecker.canInjectCredentialsToWebView(any())).thenReturn(canInjectCredentials)
111111

112112
return InlineBrowserAutofill(
113113
autofillCapabilityChecker = capabilityChecker,

autofill/autofill-internal/src/main/java/com/duckduckgo/autofill/internal/AutofillInternalSettingsActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class AutofillInternalSettingsActivity : DuckDuckGoActivity() {
117117
val autofillEnabled = autofillFeature.self()
118118
val onByDefault = autofillFeature.onByDefault()
119119
val onForExistingUsers = autofillFeature.onForExistingUsers()
120-
val canIntegrateAutofill = autofillFeature.canIntegrateAutofillInWebView()
120+
val canIntegrateAutofill = autofillFeature.canIntegrateWebMessageBasedAutofillInWebView()
121121
val canSaveCredentials = autofillFeature.canSaveCredentials()
122122
val canInjectCredentials = autofillFeature.canInjectCredentials()
123123
val canGeneratePasswords = autofillFeature.canGeneratePasswords()

0 commit comments

Comments
 (0)