Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display toolbar on all intermediary screens for drop-in #1832

Open
wants to merge 2 commits into
base: feature/google-pay
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- For UPI Intent an error message will be shown when "Continue" button is pressed without selecting
any UPI option.
- For drop-in, improved accessibility of back/close button in the navigation bar.
- For drop-in, show a toolbar on every intermediary screen, so shoppers can always easily navigate back.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file still has the old release notes


## Changed
- For drop-in, headers of preselected stored payment screen and payment methods list screen are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ internal class GooglePayComponentDialogFragment :
private lateinit var paymentMethod: PaymentMethod
private lateinit var component: GooglePayComponent

private val toolbarMode: DropInBottomSheetToolbarMode
get() = when {
dropInViewModel.shouldSkipToSinglePaymentMethod() -> DropInBottomSheetToolbarMode.CLOSE_BUTTON
else -> DropInBottomSheetToolbarMode.BACK_BUTTON
}

override fun onCreate(savedInstanceState: Bundle?) {
adyenLog(AdyenLogLevel.DEBUG) { "onCreate" }
super.onCreate(savedInstanceState)
Expand All @@ -60,6 +66,8 @@ internal class GooglePayComponentDialogFragment :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
adyenLog(AdyenLogLevel.DEBUG) { "onViewCreated" }

initToolbar()

loadComponent()

binding.componentView.attach(component, viewLifecycleOwner)
Expand All @@ -72,6 +80,14 @@ internal class GooglePayComponentDialogFragment :
.launchIn(viewLifecycleOwner.lifecycleScope)
}

private fun initToolbar() = with(binding.bottomSheetToolbar) {
setTitle(paymentMethod.name)
setOnButtonClickListener {
onBackPressed()
}
setMode(toolbarMode)
}

private fun loadComponent() {
@Suppress("SwallowedException")
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<com.adyen.checkout.dropin.internal.ui.DropInBottomSheetToolbar
android:id="@+id/bottom_sheet_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<com.adyen.checkout.ui.core.AdyenComponentView
android:id="@+id/componentView"
android:layout_width="match_parent"
Expand Down