diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/AutofillSettingsViewModel.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/AutofillSettingsViewModel.kt index 1ddc47dbffe7..bf2b51c61093 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/AutofillSettingsViewModel.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/AutofillSettingsViewModel.kt @@ -24,6 +24,7 @@ import com.duckduckgo.app.browser.favicon.FaviconManager import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.autofill.api.domain.app.LoginCredentials import com.duckduckgo.autofill.api.email.EmailManager +import com.duckduckgo.autofill.impl.InternalAutofillCapabilityChecker import com.duckduckgo.autofill.impl.R import com.duckduckgo.autofill.impl.deviceauth.DeviceAuthenticator import com.duckduckgo.autofill.impl.deviceauth.DeviceAuthenticator.AuthConfiguration @@ -107,6 +108,7 @@ class AutofillSettingsViewModel @Inject constructor( private val duckAddressIdentifier: DuckAddressIdentifier, private val syncEngine: SyncEngine, private val neverSavedSiteRepository: NeverSavedSiteRepository, + private val capabilityChecker: InternalAutofillCapabilityChecker, ) : ViewModel() { private val _viewState = MutableStateFlow(ViewState()) @@ -360,7 +362,11 @@ class AutofillSettingsViewModel @Inject constructor( fun onViewCreated() { if (combineJob != null) return combineJob = viewModelScope.launch(dispatchers.io()) { - _viewState.value = _viewState.value.copy(autofillEnabled = autofillStore.autofillEnabled) + _viewState.value = _viewState.value.copy( + autofillEnabled = autofillStore.autofillEnabled, + webViewCompatible = capabilityChecker.webViewSupportsAutofill(), + ) + val allCredentials = autofillStore.getAllCredentials().distinctUntilChanged() val combined = allCredentials.combine(searchQueryFilter) { credentials, filter -> credentialListFilter.filter(credentials, filter) @@ -640,6 +646,7 @@ class AutofillSettingsViewModel @Inject constructor( val logins: List? = null, val credentialMode: CredentialMode? = null, val credentialSearchQuery: String = "", + val webViewCompatible: Boolean = true, ) /** diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/viewing/AutofillManagementListMode.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/viewing/AutofillManagementListMode.kt index 5701961a661d..6bfff6264571 100644 --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/viewing/AutofillManagementListMode.kt +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/ui/credential/management/viewing/AutofillManagementListMode.kt @@ -220,6 +220,12 @@ class AutofillManagementListMode : DuckDuckGoFragment(R.layout.fragment_autofill binding.credentialToggleGroup.gone() binding.logins.updateTopMargin(resources.getDimensionPixelSize(CommonR.dimen.keyline_4)) } + + if (state.webViewCompatible) { + binding.webViewUnsupportedWarningPanel.gone() + } else { + binding.webViewUnsupportedWarningPanel.show() + } } } } diff --git a/autofill/autofill-impl/src/main/res/layout/fragment_autofill_management_list_mode.xml b/autofill/autofill-impl/src/main/res/layout/fragment_autofill_management_list_mode.xml index f0de78b0d7bb..cc60c01db729 100644 --- a/autofill/autofill-impl/src/main/res/layout/fragment_autofill_management_list_mode.xml +++ b/autofill/autofill-impl/src/main/res/layout/fragment_autofill_management_list_mode.xml @@ -26,6 +26,18 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + app:layout_constraintTop_toBottomOf="@id/webViewUnsupportedWarningPanel"/>