Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #24969 - Display address autofill prompt #25227

Merged
merged 2 commits into from
Jun 15, 2022
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 @@ -76,6 +76,7 @@ import mozilla.components.feature.session.PictureInPictureFeature
import mozilla.components.feature.session.SessionFeature
import mozilla.components.feature.session.SwipeRefreshFeature
import mozilla.components.concept.engine.permission.SitePermissions
import mozilla.components.feature.prompts.address.AddressDelegate
import mozilla.components.feature.session.ScreenOrientationFeature
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
import mozilla.components.lib.state.ext.consumeFlow
Expand Down Expand Up @@ -636,6 +637,14 @@ abstract class BaseBrowserFragment :
},
onSelectCreditCard = {
showBiometricPrompt(context)
},
addressDelegate = object : AddressDelegate {
override val addressPickerView
get() = binding.addressSelectBar
override val onManageAddresses = {
val directions = NavGraphDirections.actionGlobalAutofillSettingFragment()
findNavController().navigate(directions)
}
}
),
owner = this,
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/res/layout/fragment_browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:id="@+id/browserLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/creditCardSelectBar"
app:layout_constraintBottom_toTopOf="@+id/addressSelectBar"
app:layout_constraintTop_toTopOf="parent"
tools:context="browser.BrowserFragment">

Expand Down Expand Up @@ -68,13 +68,21 @@

</androidx.coordinatorlayout.widget.CoordinatorLayout>

<mozilla.components.feature.prompts.address.AddressSelectBar
android:visibility="gone"
android:id="@+id/addressSelectBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/creditCardSelectBar"
app:layout_constraintTop_toBottomOf="@id/browserLayout" />

<mozilla.components.feature.prompts.creditcard.CreditCardSelectBar
android:visibility="gone"
android:id="@+id/creditCardSelectBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/loginSelectBar"
app:layout_constraintTop_toBottomOf="@id/browserLayout" />
app:layout_constraintTop_toBottomOf="@id/addressSelectBar" />

<mozilla.components.feature.prompts.login.LoginSelectBar
android:visibility="gone"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
tools:ignore="UnusedResources">@color/fx_mobile_text_color_warning</item>
<item name="mozacLoginSelectHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>
<item name="mozacSelectCreditCardHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>
<item name="mozacSelectAddressHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>

<!-- Design system color attributes -->

Expand Down Expand Up @@ -227,6 +228,7 @@
tools:ignore="UnusedResources">@color/fx_mobile_private_text_color_warning</item>
<item name="mozacLoginSelectHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>
<item name="mozacSelectCreditCardHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>
<item name="mozacSelectAddressHeaderTextStyle" tools:ignore="UnusedResources">@style/SelectPromptHeaderTextStyle</item>

<!-- Design system color attributes -->

Expand Down