Skip to content

Conversation

@pwltr
Copy link
Contributor

@pwltr pwltr commented Dec 23, 2025

Description

  • fix(ui): toasts not showing after soft crash
  • fix(send): max send amount incorrect for onchain invoice
  • fix(ui): numberpad: remove spaces from raw input

@pwltr pwltr changed the title Fix/various fixes fix: various fixes Dec 23, 2025
@pwltr pwltr force-pushed the fix/various-fixes branch 2 times, most recently from 14de260 to e1af5f3 Compare December 23, 2025 16:32
@pwltr pwltr marked this pull request as ready for review December 23, 2025 16:32
@pwltr pwltr force-pushed the fix/various-fixes branch from e1af5f3 to 3a00f37 Compare December 23, 2025 16:35
@pwltr pwltr force-pushed the fix/various-fixes branch from 3a00f37 to 0be7feb Compare December 23, 2025 18:24
@pwltr
Copy link
Contributor Author

pwltr commented Dec 23, 2025

@jvsena42 @ovitrif Note the number pad fix, from a quick test it is needed on Android as well.

@jvsena42 jvsena42 requested a review from Copilot December 24, 2025 10:14
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 addresses three distinct issues: toast notifications not appearing after app crashes, incorrect maximum sendable amounts for onchain invoices, and deletion behavior problems in the number pad when using spaces as digit separators.

Key Changes:

  • Added crash recovery logic to ensure toast window is properly recreated after soft crashes
  • Fixed max sendable amount calculation to recalculate when fee rates change and handle errors properly
  • Corrected number pad deletion behavior by removing spaces from raw input for modern Bitcoin display

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
BitkitTests/NumberPadTests.swift Added test coverage for delete functionality with formatted text containing spaces
Bitkit/Views/Wallets/Send/SendAmountView.swift Added fee rate change listener and fixed error handling for max amount calculation
Bitkit/Views/Settings/DevSettingsView.swift Added crash simulation button for testing crash recovery
Bitkit/ViewModels/AmountInputViewModel.swift Fixed raw input text handling to remove spaces for modern Bitcoin display
Bitkit/Managers/ToastWindowManager.swift Enhanced window lifecycle management and crash recovery for toast notifications

Comment on lines +177 to +184
.onChange(of: wallet.selectedFeeRateSatsPerVByte) { _ in
// Recalculate max sendable amount when fee rate becomes available or changes
if app.selectedWalletToPayFrom == .onchain {
Task {
await calculateMaxSendableAmount()
}
}
}
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The onChange closure uses an unnamed parameter '_' but never checks if the fee rate is valid or non-zero. Consider adding a guard statement to verify the fee rate is set before recalculating: guard wallet.selectedFeeRateSatsPerVByte > 0 else { return }

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
existingWindow.windowScene != nil,
!existingWindow.isHidden
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The condition checks if the window is not hidden, but a valid window could be hidden and still functional. Consider removing the !existingWindow.isHidden check, as the window should be shown when needed regardless of its current hidden state.

Suggested change
existingWindow.windowScene != nil,
!existingWindow.isHidden
existingWindow.windowScene != nil

Copilot uses AI. Check for mistakes.
Comment on lines +179 to +181
for scene in UIApplication.shared.connectedScenes {
if let windowScene = scene as? UIWindowScene,
windowScene.activationState == .foregroundActive || windowScene.activationState == .foregroundInactive
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The activation state check could be simplified and made more maintainable by storing the valid states in an array. Consider: let validStates: [UIScene.ActivationState] = [.foregroundActive, .foregroundInactive] and then validStates.contains(windowScene.activationState)

Suggested change
for scene in UIApplication.shared.connectedScenes {
if let windowScene = scene as? UIWindowScene,
windowScene.activationState == .foregroundActive || windowScene.activationState == .foregroundInactive
let validStates: [UIScene.ActivationState] = [.foregroundActive, .foregroundInactive]
for scene in UIApplication.shared.connectedScenes {
if let windowScene = scene as? UIWindowScene,
validStates.contains(windowScene.activationState)

Copilot uses AI. Check for mistakes.
Copy link
Member

@jvsena42 jvsena42 left a comment

Choose a reason for hiding this comment

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

Tested:

  • Max send amount
  • Switch between classic and modern input

@ovitrif ovitrif merged commit 6b2c8a7 into master Dec 24, 2025
11 of 12 checks passed
@ovitrif ovitrif deleted the fix/various-fixes branch December 24, 2025 12:13
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.

4 participants