Skip to content

Conversation

@ovitrif
Copy link
Collaborator

@ovitrif ovitrif commented Jan 9, 2026

This PR:

  1. Localizes remaining hardcoded strings
  2. Adds dynamic boost fee time estimates for transaction acceleration
  3. Implements weather widget API response caching
  4. Fixes WalletRepo state management by replacing uiState with individual repo states
  5. Cleans up deprecated code, warnings, and TODOs across the codebase

Description

The PR addresses multiple code quality improvements and new features:

  • feat: Dynamic boost fee time estimates that show confirmation time based on fee rate
  • feat: Weather widget API caching to reduce network calls
  • refactor: Convert NotificationUtils functions to extension functions
  • refactor: Replace combined uiState to direct use of separate repo state flows
  • refactor: Simplify LightningService by removing redundant state management

Cleanup

  • Remove deprecated LdkMigrationTest.kt
  • Remove completed TODOs and fix remaining ones
  • Update AGP, added compose-stability-analyzer dependency
  • Fix or suppress all lint warnings
  • Update README and documentation

Preview

N/A

QA Notes

Tests:

1. Boost Fee Estimates

  • Open a pending on-chain transaction
  • Tap boost/accelerate
  • Verify fee slider shows dynamic time estimates (e.g., "~10 min", "~30 min")

3. Weather Widget

  • Enable weather widget
  • Observe API calls are cached (check logs)
  • Widget should still update but without excessive network requests

4. Regression Testing

  • Verify wallet balance displays correctly
  • Test sending and receiving Lightning payments
  • Confirm background notifications work as expected

@ovitrif ovitrif self-assigned this Jan 9, 2026
@ovitrif ovitrif changed the title chore: fix warnings and cleanup codebase chore: fix all warnings and cleanup codebase Jan 9, 2026
@ovitrif ovitrif changed the title chore: fix all warnings and cleanup codebase chore: fix all warnings and code cleanup Jan 9, 2026
@ovitrif ovitrif marked this pull request as ready for review January 13, 2026 20:39
@ovitrif ovitrif requested review from ben-kaufman, jvsena42 and piotr-iohk and removed request for ben-kaufman and jvsena42 January 13, 2026 20:43
@claude

This comment has been minimized.

@jvsena42 jvsena42 requested a review from Copilot January 13, 2026 21:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs comprehensive code cleanup and quality improvements across the codebase, addressing warnings, localizing hardcoded strings, and implementing new features for boost fee estimation and weather widget caching.

Changes:

  • Adds dynamic boost fee time estimates based on fee rates
  • Implements API response caching for weather widget
  • Localizes remaining hardcoded strings throughout the UI
  • Refactors error handling to use runCatching pattern consistently
  • Removes deprecated code and updates dependencies
  • Converts NotificationUtils object functions to extension functions
  • Simplifies state management by removing combined MainUiState in favor of direct repository state usage

Reviewed changes

Copilot reviewed 174 out of 176 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gradle/libs.versions.toml Updates AGP to 8.13.2 and adds compose stability analyzer plugin
docs/strings.md Adds comprehensive documentation of dev-only strings that don't need translation
config/detekt/detekt.yml Expands magic number ignore list for common technical values
app/src/main/res/values/strings.xml Adds numerous localized strings for errors, settings, and UI elements
app/src/main/java/to/bitkit/ui/sheets/BoostTransactionViewModel.kt Implements dynamic fee time estimation based on blocktank fee rates
app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt Removes deprecated combined uiState in favor of individual state flows
app/src/main/java/to/bitkit/services/LightningService.kt Extensive cleanup including better logging, error handling, and removing deprecated fee conversion
app/src/main/java/to/bitkit/utils/Errors.kt Converts sealed class error objects to classes for proper exception cause chains
app/src/main/java/to/bitkit/ui/utils/NotificationUtils.kt Deleted file - functions converted to Context extensions
app/src/main/java/to/bitkit/ui/Notifications.kt Adds notification utility extension functions for Context

@ovitrif ovitrif enabled auto-merge January 14, 2026 02:56
@claude
Copy link

claude bot commented Jan 14, 2026

Code Review

I found 10 high-signal issues that need attention:

Critical Bugs (2)

1. Variable Shadowing Bug in ActivityListViewModel

File: app/src/main/java/to/bitkit/viewmodels/ActivityListViewModel.kt
Line: 92
Link:

}.collect {
_filteredActivities.update { it }
}

Issue: The inner it inside update { } shadows the outer it from collect. This will cause filtered activities to never update.

Fix - revert to original:
}.collect { _filteredActivities.value = it }


2. Non-local Returns Bypass Cleanup in TransferViewModel

File: app/src/main/java/to/bitkit/viewmodels/TransferViewModel.kt
Lines: 232, 250
Link:

// Poll until payment is confirmed (order state becomes PAID or EXECUTED)
val paidOrder = pollUntil(orderId) { order ->
order.state2 == BtOrderState2.PAID || order.state2 == BtOrderState2.EXECUTED
} ?: return Result.failure(Exception("Order not found or expired"))
// Step 1: Payment confirmed
settingsStore.update { it.copy(lightningSetupStep = LN_SETUP_STEP_1) }
Logger.debug("LN setup step: $LN_SETUP_STEP_1", context = TAG)
delay(MIN_STEP_DELAY_MS)
// Try to open channel (idempotent - safe to call multiple times)
blocktankRepo.openChannel(paidOrder.id)
// Step 2: Channel opening requested
settingsStore.update { it.copy(lightningSetupStep = LN_SETUP_STEP_2) }
Logger.debug("LN setup step: $LN_SETUP_STEP_2", context = TAG)
delay(MIN_STEP_DELAY_MS)
// Poll until channel is ready (EXECUTED state or channel has state)
pollUntil(orderId) { order ->
order.state2 == BtOrderState2.EXECUTED || order.channel?.state != null
} ?: return Result.failure(Exception("Order not found or expired"))
// Step 3: Complete
transferRepo.syncTransferStates()
settingsStore.update { it.copy(lightningSetupStep = LN_SETUP_STEP_3) }
Logger.debug("LN setup step: $LN_SETUP_STEP_3", context = TAG)
Logger.debug("Order settled: '$orderId'", context = TAG)
return@runCatching true
}.onFailure {
Logger.error("Failed to watch order: '$orderId'", it, context = TAG)
}.also {
Logger.debug("Stopped watching order: '$orderId'", context = TAG)
}

Issue: Non-local return statements skip the .also { } cleanup block that replaced the original finally block.

Fix: Use labeled returns: return@runCatching Result.failure(...)


CLAUDE.md Violations (8)

Rule: NEVER use file-level @file:Suppress(...) annotations
Reference: CLAUDE.md Line 210

Files with violations:

  1. app/src/main/java/to/bitkit/models/AddressType.kt
  2. app/src/main/java/to/bitkit/ui/ContentView.kt
  3. app/src/main/java/to/bitkit/ui/components/Button.kt
  4. app/src/main/java/to/bitkit/ui/components/LightningChannel.kt
  5. app/src/main/java/to/bitkit/ui/components/Text.kt
  6. app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveConfirmScreen.kt
  7. app/src/main/java/to/bitkit/ui/settings/backups/ResetAndRestoreScreen.kt
  8. app/src/main/java/to/bitkit/ui/settings/lightning/components/ChannelStatusView.kt

Recommendation: Move @Suppress annotations to specific declarations (class/function/property level).


Summary: 2 critical bugs + 8 CLAUDE.md violations. All issues validated with high confidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants