diff --git a/app/src/main/java/to/bitkit/ui/screens/wallets/usdt/UsdtDepositReceiveScreen.kt b/app/src/main/java/to/bitkit/ui/screens/wallets/usdt/UsdtDepositReceiveScreen.kt index b27d41339d..2ba4797c0f 100644 --- a/app/src/main/java/to/bitkit/ui/screens/wallets/usdt/UsdtDepositReceiveScreen.kt +++ b/app/src/main/java/to/bitkit/ui/screens/wallets/usdt/UsdtDepositReceiveScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -52,6 +53,7 @@ import to.bitkit.ui.components.usdtOverviewAmount import to.bitkit.ui.scaffold.SheetTopBar import to.bitkit.ui.screens.wallets.activity.components.CustomTabRowWithSpacing import to.bitkit.ui.screens.wallets.receive.ReceiveTab +import to.bitkit.ui.shared.modifiers.swipeToChangeTab import to.bitkit.ui.theme.AppTextStyles import to.bitkit.ui.theme.Colors import java.text.DecimalFormatSymbols @@ -132,44 +134,58 @@ internal fun ColumnScope.UsdtDepositReceiveScreen( VerticalSpacer(16.dp) } walletUi.error?.let { BodyS(stringResource(it), color = Colors.Brand) } - Content( - page = page, - onPage = { page = it }, - wallet = wallet, - receiveError = walletUi.refreshError, - state = state, - amount = if (page == ReceivePage.AMOUNT) draftAmount else amount, - onNetwork = { - if (state.network != it) { - amount = "" - draftAmount = "" - deposits.selectNetwork(it) - } - page = if (it == null || state.address != null && state.network == it) { - ReceivePage.ADDRESS - } else { - ReceivePage.AMOUNT - } - }, - onAmount = { - if (draftAmount != it) deposits.clearError() - draftAmount = it - }, - onCreate = { - if (state.network == null) { - amount = draftAmount - page = ReceivePage.ADDRESS - } else { - deposits.prepare(draftAmount) - } - }, - onHistory = { app?.navigateToUsdtDeposits() }, - onRefresh = { - draftAmount = if (state.network == null) amount else draftAmount - deposits.selectNetwork(state.network) - page = ReceivePage.AMOUNT - }, - ) + val tabIndex = tabs.indexOf(ReceiveTab.USDT) + Column( + modifier = Modifier + .weight(1f) + .fillMaxWidth() + .then( + if (page == ReceivePage.ADDRESS) { + Modifier.swipeToChangeTab(tabIndex, tabs.size, { onSelectTab(tabs[it]) }) + } else { + Modifier + } + ) + ) { + Content( + page = page, + onPage = { page = it }, + wallet = wallet, + receiveError = walletUi.refreshError, + state = state, + amount = if (page == ReceivePage.AMOUNT) draftAmount else amount, + onNetwork = { + if (state.network != it) { + amount = "" + draftAmount = "" + deposits.selectNetwork(it) + } + page = if (it == null || state.address != null && state.network == it) { + ReceivePage.ADDRESS + } else { + ReceivePage.AMOUNT + } + }, + onAmount = { + if (draftAmount != it) deposits.clearError() + draftAmount = it + }, + onCreate = { + if (state.network == null) { + amount = draftAmount + page = ReceivePage.ADDRESS + } else { + deposits.prepare(draftAmount) + } + }, + onHistory = { app?.navigateToUsdtDeposits() }, + onRefresh = { + draftAmount = if (state.network == null) amount else draftAmount + deposits.selectNetwork(state.network) + page = ReceivePage.AMOUNT + }, + ) + } } @Composable diff --git a/changelog.d/next/1582.fixed.md b/changelog.d/next/1582.fixed.md new file mode 100644 index 0000000000..d072cf5283 --- /dev/null +++ b/changelog.d/next/1582.fixed.md @@ -0,0 +1 @@ +Swiping over the USDT receive QR now changes tabs instead of copying the address. diff --git a/journeys/receive/usdt-receive-swipe-tabs.xml b/journeys/receive/usdt-receive-swipe-tabs.xml new file mode 100644 index 0000000000..95683d4fc5 --- /dev/null +++ b/journeys/receive/usdt-receive-swipe-tabs.xml @@ -0,0 +1,27 @@ + + + On the Receive sheet, swiping sideways over the QR changes tabs on every tab, USDT included. + With USDT selected, a swipe to the right over its QR selects the tab before it (Spending) and + does not copy the address; a swipe to the left does nothing, since USDT is the last tab. A single + tap on the USDT QR still copies the address and shows the "copied" tooltip. + + Precondition: onboarded dev wallet with USDT enabled (introductory sheet or Settings, General, + Payments), no CJIT invoice pending, start on the wallet home screen. The USDT address loads + without funding; wait for the QR before swiping. + + The copy shows as a tooltip over the QR for about two seconds, so a check for "no copy" reads a + screenshot taken right after the swipe. Swipe with `adb shell input swipe` across the middle of + the QR, about 60% of its width, in 300 ms. Back from Spending to USDT goes through the tab + pager, which snaps back from a 300 ms synthetic swipe on the emulator; a 600 ms swipe moves it. + On a wallet without a Lightning channel, Spending shows its setup view instead of a QR. + + + Tap Receive (testTag "Receive") + Tap the USDT tab (testTag "Tab-usdt") and wait until the USDT QR is visible + Swipe right across the QR and take a screenshot right away + Verify the Spending tab (testTag "Tab-spending") is selected, the Lightning receive content or the Spending setup is shown, and the screenshot shows no "copied" tooltip + Swipe left across the middle of the Spending content, whether it shows a Lightning QR or the Spending setup, in 600 ms (`adb shell input swipe 900 1200 150 1200 600`); verify the USDT tab is selected and wait until its QR is visible + Swipe left across the USDT QR and take a screenshot right away; verify the USDT tab stays selected and the screenshot shows no "copied" tooltip + Tap the USDT QR once and verify the "copied" tooltip appears + +