refactor: make linter happy

This commit is contained in:
2026-06-12 18:20:26 +02:00
parent c155f43870
commit 4e22f4d3e9
9 changed files with 16 additions and 25 deletions
@@ -75,11 +75,10 @@ class BalanceViewModel(
runCatching { repo.getBalance() }
.onSuccess { balance ->
val sats = balance.sats
val prev = (_balanceState.value as? BalanceState.Success)?.sats
when {
prev == null -> Timber.d("BALANCE [NETWORK ] $sats sats — cold load complete")
prev == sats -> Timber.d("BALANCE [NETWORK ] $sats sats — matches cache, no change")
else -> Timber.d("BALANCE [NETWORK ] $sats sats — was $prev sats (diff ${sats - prev})")
when (val prev = (_balanceState.value as? BalanceState.Success)?.sats) {
null -> Timber.d("BALANCE [NETWORK ] $sats sats — cold load complete")
sats -> Timber.d("BALANCE [NETWORK ] $sats sats — matches cache, no change")
else -> Timber.d("BALANCE [NETWORK ] $sats sats — was $prev sats (diff ${sats - prev})")
}
_balanceState.value = BalanceState.Success(
sats = sats,
@@ -14,7 +14,6 @@ import com.bitcointxoko.gudariwallet.util.satsToFiat
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
@@ -21,6 +21,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlin.time.Duration.Companion.milliseconds
private const val TAG = "HistoryViewModel"
@@ -156,7 +157,7 @@ class HistoryViewModel(
viewModelScope.launch {
combine(
_filter.map { it.searchQuery }.debounce(300),
_filter.map { it.searchQuery }.debounce(300.milliseconds),
_filter
) { _, f -> f }
.collect { f ->
@@ -164,10 +165,8 @@ class HistoryViewModel(
Timber.d("FILTER [IN-MEMORY] filter=default → using cached state")
_roomResults.value = null
} else {
Timber.d("FILTER [ROOM ] q=\"${f.searchQuery}\" " +
"statuses=${f.statuses} dir=${f.direction} types=${f.types} " +
"amt=${f.minAmountSat}${f.maxAmountSat} " +
"date=${f.minCreatedAt}${f.maxCreatedAt}")
Timber.d("%snull", "FILTER [ROOM ] q=\"${f.searchQuery}\" " +
"statuses=${f.statuses} dir=${f.direction} types=${f.types} ")
_roomResults.value = paymentCache.queryAll(f.searchQuery, f)
}
}
@@ -17,7 +17,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowDownward
import androidx.compose.material.icons.filled.ArrowUpward
import androidx.compose.material.icons.outlined.ContentCopy
import androidx.compose.material3.Card
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -159,8 +159,7 @@ class PaymentSyncManager(
val reachedEnd = page.size < WalletConstants.PAYMENTS_PAGE_SIZE
if (reachedOverlap || reachedEnd) {
Timber.d("PAYMENTS [SYNC DONE ] $totalNew new payment(s) across $pagesChecked page(s) — " +
if (reachedOverlap) "stopped at known record" else "reached end of history")
Timber.d("null%s", if (reachedOverlap) "stopped at known record" else "reached end of history")
break
}
@@ -77,13 +77,12 @@ class NdefHceService : HostApduService() {
val ins = apdu[1]
return when {
return when (ins) {
// ── SELECT (INS = 0xA4) ──────────────────────────────────────────
ins == 0xA4.toByte() -> handleSelect(apdu)
0xA4.toByte() -> handleSelect(apdu)
// ── READ BINARY (INS = 0xB0) ─────────────────────────────────────
ins == 0xB0.toByte() -> handleReadBinary(apdu)
0xB0.toByte() -> handleReadBinary(apdu)
else -> SW_UNKNOWN
}.also { Timber.d("APDU OUT: ${it.toHex()}") }
}
@@ -13,7 +13,6 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.bitcointxoko.gudariwallet.ui.NfcOfferState
import com.bitcointxoko.gudariwallet.util.SendInputDetector
import com.bitcointxoko.gudariwallet.util.SendInputType
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -83,7 +82,7 @@ class NfcViewModel : ViewModel() {
intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)
}
if (rawMessages != null && rawMessages.isNotEmpty()) {
if (!rawMessages.isNullOrEmpty()) {
val message = rawMessages[0] as NdefMessage
val uri = extractUri(message)
if (uri != null) {
@@ -98,7 +97,7 @@ class NfcViewModel : ViewModel() {
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG, Tag::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)
}
if (tag != null) {
viewModelScope.launch(Dispatchers.IO) {
@@ -265,7 +265,7 @@ fun NotificationsPage(
imageVector = Icons.Default.Notifications,
contentDescription = null,
modifier = Modifier.size(72.dp),
// Mirror the BatteryPage tint behaviour
// Mirror the BatteryPage tint behavior
tint = if (alreadyGranted)
MaterialTheme.colorScheme.primary
else
@@ -300,7 +300,7 @@ fun NotificationsPage(
}
}
// ── Page 5: Battery optimisation ──────────────────────────────────────────────
// ── Page 5: Battery optimization ──────────────────────────────────────────────
@Composable
fun BatteryPage(strings: AppStrings) {
val context = LocalContext.current
@@ -13,11 +13,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.work.WorkInfo
import com.bitcointxoko.gudariwallet.LocalAppStrings
import com.bitcointxoko.gudariwallet.data.HistoricalSyncStore
import com.bitcointxoko.gudariwallet.security.SecretStore
import com.bitcointxoko.gudariwallet.sync.HistoricalSyncWorker
import kotlinx.coroutines.launch
import timber.log.Timber