Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/next/1582.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Swiping over the USDT receive QR now changes tabs instead of copying the address.
27 changes: 27 additions & 0 deletions journeys/receive/usdt-receive-swipe-tabs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<journey name="usdt receive swipe tabs">
<description>
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.
</description>
<actions>
<action>Tap Receive (testTag "Receive")</action>
<action>Tap the USDT tab (testTag "Tab-usdt") and wait until the USDT QR is visible</action>
<action>Swipe right across the QR and take a screenshot right away</action>
<action>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</action>
<action>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</action>
<action>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</action>
<action>Tap the USDT QR once and verify the "copied" tooltip appears</action>
</actions>
</journey>
Loading