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

Bottom sheet dialogs should dismiss instead of hiding when a button is pressed #3951

Merged

Conversation

CDRussell
Copy link
Member

@CDRussell CDRussell commented Dec 1, 2023

Task/Issue URL: https://app.asana.com/0/488551667048375/1206077448728301/f

Description

When a button is pressed in the bottom sheet dialogs, ensure we dismiss() instead of hide() to prevent unintended side-effects depending on what the caller does not (as detailed in the linked task).

Sets the dismiss listener to null before calling dismiss() to ensure we get only one of:

  • button listener invoked, OR
  • dismiss listener invoked

Steps to test this PR

  • Go to ADS internal settings->Dialogs
  • ensure the Action Botton Sheet works as expected
  • ensure the Promo Bottom Sheet works as expected

@CDRussell
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@@ -54,11 +54,13 @@ class ActionBottomSheetDialog(builder: Builder) : BottomSheetDialog(builder.cont
setOnShowListener { builder.listener.onBottomSheetShown() }
binding.actionBottomSheetDialogPrimaryItem.setOnClickListener {
builder.listener.onPrimaryItemClicked()
hide()
setOnDismissListener(null)
Copy link
Member Author

@CDRussell CDRussell Dec 1, 2023

Choose a reason for hiding this comment

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

not sure if it's worth creating a shared utility function for this... guessing not but open to it

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's ok. It's clear enough and it won't save us lines of codes, so happy to leave it as it is

@CDRussell CDRussell marked this pull request as ready for review December 1, 2023 11:50
Copy link
Contributor

@nalcalag nalcalag left a comment

Choose a reason for hiding this comment

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

LGTM!

@CDRussell CDRussell merged commit 62c85bd into develop Dec 1, 2023
9 checks passed
@CDRussell CDRussell deleted the fix/craig/ads_dialogs_should_dismiss_instead_of_hide branch December 1, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants