Ensure only a single story is displayed above the fold in bottom sheets.

This commit is contained in:
Alex Hart 2023-01-04 13:37:21 -04:00 committed by Greyson Parrelli
parent 320669c54e
commit 54d0df9a05
2 changed files with 7 additions and 3 deletions

View file

@ -410,7 +410,9 @@ class MultiselectForwardFragment :
val expandedConfig: ContactSearchConfiguration.ExpandConfig? = if (isSelectedMediaValidForNonStories()) {
ContactSearchConfiguration.ExpandConfig(
isExpanded = contactSearchState.expandedSections.contains(ContactSearchConfiguration.SectionKey.STORIES),
maxCountWhenNotExpanded = { it + 1 }
maxCountWhenNotExpanded = {
if (args.isWrappedInBottomSheet) 1 else it + 1
}
)
} else {
null
@ -514,7 +516,7 @@ class MultiselectForwardFragment :
fun showBottomSheet(supportFragmentManager: FragmentManager, multiselectForwardFragmentArgs: MultiselectForwardFragmentArgs) {
val fragment = MultiselectForwardBottomSheet()
showDialogFragment(supportFragmentManager, fragment, multiselectForwardFragmentArgs)
showDialogFragment(supportFragmentManager, fragment, multiselectForwardFragmentArgs.copy(isWrappedInBottomSheet = true))
}
@JvmStatic

View file

@ -35,6 +35,7 @@ import java.util.function.Consumer
* @param forceDisableAddMessage Hide the add message field even if it would normally be available.
* @param forceSelectionOnly Force the fragment to only select recipients, never actually performing the send.
* @param selectSingleRecipient Only allow the selection of a single recipient.
* @param isWrappedInBottomSheet Whether the fragment is wrapped in a bottom sheet.
*/
@Parcelize
data class MultiselectForwardFragmentArgs @JvmOverloads constructor(
@ -47,7 +48,8 @@ data class MultiselectForwardFragmentArgs @JvmOverloads constructor(
val sendButtonColors: ViewColorSet = ViewColorSet.PRIMARY,
val storySendRequirements: Stories.MediaTransform.SendRequirements = Stories.MediaTransform.SendRequirements.CAN_NOT_SEND,
val isSearchEnabled: Boolean = true,
val isViewOnce: Boolean = false
val isViewOnce: Boolean = false,
val isWrappedInBottomSheet: Boolean = false
) : Parcelable {
fun withSendButtonTint(@ColorInt sendButtonTint: Int) = copy(sendButtonColors = ViewColorSet.forCustomColor(sendButtonTint))