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

Don't count bottom sheets towards the back stack #8022

Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -24,16 +24,21 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.NavHostController
import com.stripe.android.financialconnections.R
import com.stripe.android.financialconnections.navigation.bottomsheet.BottomSheetNavigator
import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview
import com.stripe.android.financialconnections.ui.LocalNavHostController
import com.stripe.android.financialconnections.ui.LocalReducedBranding
Expand Down Expand Up @@ -99,6 +104,7 @@ internal fun FinancialConnectionsTopAppBar(
)
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun BackButton(
scope: CoroutineScope,
Expand All @@ -116,7 +122,10 @@ private fun BackButton(
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = "Back icon",
tint = FinancialConnectionsTheme.colors.iconDefault
tint = FinancialConnectionsTheme.colors.iconDefault,
modifier = Modifier
.testTag("top-app-bar-back-button")
.semantics { testTagsAsResourceId = true }
)
}
}
Expand Down Expand Up @@ -198,8 +207,12 @@ internal val LazyListState.elevation: Dp
private fun NavHostController.collectCanGoBackAsState(): State<Boolean> {
val canGoBack = remember { mutableStateOf(false) }
tillh-stripe marked this conversation as resolved.
Show resolved Hide resolved
DisposableEffect(Unit) {
val listener = NavController.OnDestinationChangedListener { controller, _, _ ->
canGoBack.value = controller.previousBackStackEntry != null
val listener = NavController.OnDestinationChangedListener { controller, destination, _ ->
if (destination.navigatorName == BottomSheetNavigator::class.java.simpleName) {
// We're looking at a bottom sheet, so don't change the back button
} else {
canGoBack.value = controller.previousBackStackEntry != null
}
}
addOnDestinationChangedListener(listener)
onDispose {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
appId: com.stripe.android.financialconnections.example
tags:
- all
- edge
- testmode-payments
---
- startRecording: ${'/tmp/test_results/testmode-paymentintent-testinstitution-networking-returning-user-' + new Date().getTime()}
- clearState
- openLink: stripeconnectionsexample://playground?flow=PaymentIntent&financial_connections_override_native=native&merchant=networking_testmode&permissions=transactions,payment_method
- tapOn:
id: "Customer email setting"
- inputText: "email@email.com"
- hideKeyboard
- tapOn:
id: "connect_accounts"
# Wait until the consent button is visible
- extendedWaitUntil:
visible:
id: "consent_cta"
timeout: 30000
- tapOn:
id: "consent_cta"
# LINK WARMUP PANE
- extendedWaitUntil:
visible:
id: "existing_email-button"
timeout: 5000
- assertNotVisible:
id: "top-app-bar-back-button"
- tapOn:
id: "existing_email-button"
# OTP SCREEN
- extendedWaitUntil:
visible: "Save your account to Link"
timeout: 5000
- assertVisible:
id: "top-app-bar-back-button"
- inputText: "000000"
# SELECT ACCOUNT
- extendedWaitUntil:
visible: "Select account"
timeout: 5000
- tapOn: "Account Closed"
- tapOn: "Connect account"
# EMAIL OTP SCREEN
- waitForAnimationToEnd
- inputText: "000000"
# CONFIRM AND COMPLETE
- waitForAnimationToEnd
- assertVisible: "Success"
- stopRecording
Loading