refactor: make linter happy

This commit is contained in:
2026-06-12 18:23:18 +02:00
parent 4e22f4d3e9
commit 8c84eca8eb
6 changed files with 9 additions and 34 deletions
@@ -1,29 +0,0 @@
package com.bitcointxoko.gudariwallet.ui.receive
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.BrightnessHigh
import androidx.compose.material.icons.filled.BrightnessLow
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import com.bitcointxoko.gudariwallet.LocalAppStrings
@Composable
internal fun BrightnessToggleButton(
isOn : Boolean,
onToggle: () -> Unit
) {
val strings = LocalAppStrings.current
IconButton(onClick = onToggle) {
Icon(
imageVector = if (isOn) Icons.Filled.BrightnessHigh
else Icons.Filled.BrightnessLow,
contentDescription = if (isOn) strings.receive.brightnessReduce // ← "Reduce brightness"
else strings.receive.brightnessBoost, // ← "Boost brightness"
tint = if (isOn) MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
@@ -64,6 +64,7 @@ import com.bitcointxoko.gudariwallet.ui.nfc.NfcViewModel
import com.bitcointxoko.gudariwallet.util.buildUpTaps import com.bitcointxoko.gudariwallet.util.buildUpTaps
import com.bitcointxoko.gudariwallet.util.fiatLabel import com.bitcointxoko.gudariwallet.util.fiatLabel
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.milliseconds
@Composable @Composable
fun ReceiveScreen( fun ReceiveScreen(
@@ -636,7 +637,7 @@ private fun ReceiveInvoiceContent(
} }
LaunchedEffect(state.expiresAt) { LaunchedEffect(state.expiresAt) {
while (secondsLeft > 0L) { while (secondsLeft > 0L) {
delay(1_000L) delay(1_000L.milliseconds)
secondsLeft = (state.expiresAt - System.currentTimeMillis() / 1000L) secondsLeft = (state.expiresAt - System.currentTimeMillis() / 1000L)
.coerceAtLeast(0L) .coerceAtLeast(0L)
} }
@@ -37,6 +37,7 @@ import kotlinx.coroutines.delay
import java.time.Instant import java.time.Instant
import java.time.ZoneId import java.time.ZoneId
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import kotlin.time.Duration.Companion.milliseconds
@Composable @Composable
internal fun Bolt11ConfirmCard( internal fun Bolt11ConfirmCard(
@@ -117,7 +118,7 @@ private fun ConfirmCardContent(
var now by remember { mutableStateOf(Instant.now()) } var now by remember { mutableStateOf(Instant.now()) }
LaunchedEffect(expiresAt) { LaunchedEffect(expiresAt) {
while (true) { while (true) {
delay(1_000L) delay(1_000L.milliseconds)
now = Instant.now() now = Instant.now()
} }
} }
@@ -3,6 +3,7 @@ package com.bitcointxoko.gudariwallet.ui.send
import timber.log.Timber import timber.log.Timber
import com.bitcointxoko.gudariwallet.data.WalletRepository import com.bitcointxoko.gudariwallet.data.WalletRepository
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.milliseconds
class PaymentPoller(private val repo: WalletRepository) { class PaymentPoller(private val repo: WalletRepository) {
@@ -19,7 +20,7 @@ class PaymentPoller(private val repo: WalletRepository) {
maxAttempts : Int = 120, maxAttempts : Int = 120,
): PollResult { ): PollResult {
repeat(maxAttempts) { attempt -> repeat(maxAttempts) { attempt ->
delay(intervalMs) delay(intervalMs.milliseconds)
val detail = runCatching { repo.getPaymentDetail(paymentHash) }.getOrNull() val detail = runCatching { repo.getPaymentDetail(paymentHash) }.getOrNull()
@@ -37,6 +37,7 @@ import com.bitcointxoko.gudariwallet.util.fiatLabel
import com.bitcointxoko.gudariwallet.util.heavyClick import com.bitcointxoko.gudariwallet.util.heavyClick
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.time.Duration.Companion.milliseconds
@Composable @Composable
fun SendScreen( fun SendScreen(
@@ -218,7 +219,7 @@ fun SendScreen(
var slowPayment by remember { mutableStateOf(false) } var slowPayment by remember { mutableStateOf(false) }
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
delay(10_000L) delay(10_000L.milliseconds)
slowPayment = true slowPayment = true
} }
@@ -175,7 +175,7 @@ class SendViewModel(
} }
} }
private suspend fun emitPaymentSent( private fun emitPaymentSent(
paymentHash : String, paymentHash : String,
amountSats : Long, amountSats : Long,
feeSats : Long?, feeSats : Long?,