-
Notifications
You must be signed in to change notification settings - Fork 659
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
Link Wallet menu #9872
base: master
Are you sure you want to change the base?
Link Wallet menu #9872
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ import androidx.compose.ui.unit.dp | |
import com.stripe.android.link.theme.HorizontalPadding | ||
import com.stripe.android.link.theme.linkColors | ||
import com.stripe.android.link.theme.linkShapes | ||
import com.stripe.android.link.ui.BottomSheetContent | ||
import com.stripe.android.link.ui.PrimaryButton | ||
import com.stripe.android.link.ui.SecondaryButton | ||
import com.stripe.android.model.ConsumerPaymentDetails | ||
|
@@ -50,6 +51,7 @@ import com.stripe.android.uicore.utils.collectAsState | |
@Composable | ||
internal fun WalletScreen( | ||
viewModel: WalletViewModel, | ||
showBottomSheetContent: (BottomSheetContent?) -> Unit | ||
) { | ||
val state by viewModel.uiState.collectAsState() | ||
var isExpanded by rememberSaveable { mutableStateOf(false) } | ||
|
@@ -62,7 +64,12 @@ internal fun WalletScreen( | |
isExpanded = expanded | ||
}, | ||
onPrimaryButtonClick = viewModel::onPrimaryButtonClicked, | ||
onPayAnotherWayClick = viewModel::onPayAnotherWayClicked, | ||
onPayAnotherWayClicked = viewModel::onPayAnotherWayClicked, | ||
onRemoveClicked = {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Spotted by Graphite Reviewer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
onEditPaymentMethodClicked = viewModel::onEditPaymentMethodClicked, | ||
onSetDefaultClicked = {}, | ||
showBottomSheetContent = showBottomSheetContent, | ||
onAddNewPaymentMethodClicked = viewModel::onAddNewPaymentMethodClicked | ||
) | ||
} | ||
|
||
|
@@ -72,8 +79,13 @@ internal fun WalletBody( | |
isExpanded: Boolean, | ||
onItemSelected: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onExpandedChanged: (Boolean) -> Unit, | ||
onAddNewPaymentMethodClicked: () -> Unit, | ||
onPrimaryButtonClick: () -> Unit, | ||
onPayAnotherWayClick: () -> Unit, | ||
onPayAnotherWayClicked: () -> Unit, | ||
onEditPaymentMethodClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onSetDefaultClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onRemoveClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
showBottomSheetContent: (BottomSheetContent?) -> Unit | ||
) { | ||
if (state.paymentDetailsList.isEmpty()) { | ||
Box( | ||
|
@@ -105,7 +117,12 @@ internal fun WalletBody( | |
state = state, | ||
isExpanded = isExpanded, | ||
onItemSelected = onItemSelected, | ||
onExpandedChanged = onExpandedChanged | ||
onExpandedChanged = onExpandedChanged, | ||
showBottomSheetContent = showBottomSheetContent, | ||
onRemoveClicked = onRemoveClicked, | ||
onSetDefaultClicked = onSetDefaultClicked, | ||
onEditPaymentMethodClicked = onEditPaymentMethodClicked, | ||
onAddNewPaymentMethodClicked = onAddNewPaymentMethodClicked, | ||
) | ||
|
||
AnimatedVisibility(state.showBankAccountTerms) { | ||
|
@@ -128,7 +145,7 @@ internal fun WalletBody( | |
.testTag(WALLET_SCREEN_PAY_ANOTHER_WAY_BUTTON), | ||
enabled = !state.primaryButtonState.isBlocking, | ||
label = stringResource(id = R.string.stripe_wallet_pay_another_way), | ||
onClick = onPayAnotherWayClick | ||
onClick = onPayAnotherWayClicked | ||
) | ||
} | ||
} | ||
|
@@ -139,6 +156,11 @@ private fun PaymentMethodSection( | |
isExpanded: Boolean, | ||
onItemSelected: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onExpandedChanged: (Boolean) -> Unit, | ||
onAddNewPaymentMethodClicked: () -> Unit, | ||
onEditPaymentMethodClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onSetDefaultClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
onRemoveClicked: (ConsumerPaymentDetails.PaymentDetails) -> Unit, | ||
showBottomSheetContent: (BottomSheetContent?) -> Unit | ||
) { | ||
Box( | ||
modifier = Modifier | ||
|
@@ -149,8 +171,31 @@ private fun PaymentMethodSection( | |
ExpandedPaymentDetails( | ||
uiState = state, | ||
onItemSelected = onItemSelected, | ||
onMenuButtonClick = {}, | ||
onAddNewPaymentMethodClick = {}, | ||
onMenuButtonClick = { | ||
showBottomSheetContent { | ||
WalletPaymentMethodMenu( | ||
modifier = Modifier | ||
.testTag(WALLET_SCREEN_MENU_SHEET_TAG), | ||
paymentDetails = it, | ||
onEditClick = { | ||
showBottomSheetContent(null) | ||
onEditPaymentMethodClicked(it) | ||
}, | ||
onSetDefaultClick = { | ||
showBottomSheetContent(null) | ||
onSetDefaultClicked(it) | ||
}, | ||
onRemoveClick = { | ||
showBottomSheetContent(null) | ||
onRemoveClicked(it) | ||
}, | ||
onCancelClick = { | ||
showBottomSheetContent(null) | ||
} | ||
) | ||
} | ||
}, | ||
onAddNewPaymentMethodClick = onAddNewPaymentMethodClicked, | ||
onCollapse = { | ||
onExpandedChanged(false) | ||
} | ||
|
@@ -378,3 +423,4 @@ internal const val WALLET_SCREEN_PAYMENT_METHODS_LIST = "wallet_screen_payment_m | |
internal const val WALLET_SCREEN_PAY_BUTTON = "wallet_screen_pay_button" | ||
internal const val WALLET_SCREEN_PAY_ANOTHER_WAY_BUTTON = "wallet_screen_pay_another_way_button" | ||
internal const val WALLET_SCREEN_BOX = "wallet_screen_box" | ||
internal const val WALLET_SCREEN_MENU_SHEET_TAG = "wallet_screen_menu_sheet_tag" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
CardEdit
route needs to extract thepaymentDetailsId
parameter from theNavBackStackEntry
and pass it toCardEditScreen
. The current implementation drops this required parameter. Consider updating to:Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://jira.corp.stripe.com/browse/MOBILESDK-2630