Skip to content

Commit 74d7e4b

Browse files
authored
Merge branch 'master' into feat/rn-migration
2 parents 9a93bee + fa7e9f4 commit 74d7e4b

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

app/src/main/java/to/bitkit/ui/screens/widgets/DragDropColumn.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package to.bitkit.ui.screens.widgets
22

3-
import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress
3+
import androidx.compose.foundation.gestures.detectVerticalDragGestures
44
import androidx.compose.foundation.layout.Box
55
import androidx.compose.foundation.layout.Column
66
import androidx.compose.foundation.layout.Spacer
77
import androidx.compose.foundation.layout.fillMaxWidth
88
import androidx.compose.foundation.layout.height
99
import androidx.compose.runtime.Composable
1010
import androidx.compose.runtime.getValue
11+
import androidx.compose.runtime.mutableFloatStateOf
1112
import androidx.compose.runtime.mutableStateOf
1213
import androidx.compose.runtime.remember
1314
import androidx.compose.runtime.setValue
@@ -24,10 +25,10 @@ fun DragDropColumn(
2425
items: List<WidgetWithPosition>,
2526
onMove: (Int, Int) -> Unit,
2627
modifier: Modifier = Modifier,
27-
itemContent: @Composable (WidgetWithPosition, Boolean) -> Unit
28+
itemContent: @Composable (WidgetWithPosition, Boolean) -> Unit,
2829
) {
2930
var draggedItem by remember { mutableStateOf<Int?>(null) }
30-
var draggedItemOffset by remember { mutableStateOf(0f) }
31+
var draggedItemOffset by remember { mutableFloatStateOf(0f) }
3132

3233
Column(
3334
modifier = modifier
@@ -50,16 +51,16 @@ fun DragDropColumn(
5051
}
5152
)
5253
.pointerInput(Unit) {
53-
detectDragGesturesAfterLongPress(
54+
detectVerticalDragGestures(
5455
onDragStart = {
5556
draggedItem = index
5657
},
5758
onDragEnd = {
5859
draggedItem = null
5960
draggedItemOffset = 0f
6061
},
61-
onDrag = { _, dragAmount ->
62-
draggedItemOffset += dragAmount.y
62+
onVerticalDrag = { _, dragAmount ->
63+
draggedItemOffset += dragAmount
6364

6465
val itemHeight = 96.dp.toPx() // Item height + spacing (80dp + 16dp)
6566
val draggedIndex = draggedItem ?: index

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,21 @@ class AppViewModel @Inject constructor(
859859
?.let { it as? Scanner.Lightning }
860860
?.invoice
861861
?.takeIf { invoice ->
862+
if (invoice.isExpired) {
863+
toast(
864+
type = Toast.ToastType.ERROR,
865+
title = context.getString(R.string.other__scan_err_decoding),
866+
description = context.getString(R.string.other__scan__error__expired),
867+
)
868+
869+
Logger.debug(
870+
"Lightning invoice expired in unified URI, defaulting to onchain-only",
871+
context = TAG
872+
)
873+
return@takeIf false
874+
}
875+
876+
// Then check sending capacity
862877
val canSend = lightningRepo.canSend(invoice.amountSatoshis.coerceAtLeast(1u))
863878
if (!canSend) {
864879
Logger.debug("Cannot pay unified invoice using LN, defaulting to onchain-only", context = TAG)

0 commit comments

Comments
 (0)