Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Bitkit/ViewModels/WalletViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,7 @@ class WalletViewModel: ObservableObject {

let amountSats = invoiceAmountSats > 0 ? invoiceAmountSats : nil

// When geoblocked, only create Lightning invoice if we have non-LSP channels
let isGeoblocked = GeoService.shared.isGeoBlocked
let hasUsableChannels: Bool = if isGeoblocked {
hasNonLspChannels()
} else {
channels?.count ?? 0 > 0
}
let hasUsableChannels = channels?.contains(where: \.isChannelReady) ?? false

if hasUsableChannels {
if forceRefreshBolt11 || bolt11.isEmpty {
Expand Down
15 changes: 3 additions & 12 deletions Bitkit/Views/Wallets/Receive/ReceiveQr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ struct ReceiveQr: View {
}

private var hasUsableChannels: Bool {
if GeoService.shared.isGeoBlocked {
return wallet.hasNonLspChannels()
} else {
return wallet.channelCount != 0
}
return wallet.channels?.contains(where: \.isChannelReady) ?? false
}

private var availableTabItems: [TabItem<ReceiveTab>] {
Expand All @@ -67,12 +63,7 @@ struct ReceiveQr: View {
}

var showingCjitOnboarding: Bool {
// Show CJIT onboarding when:
// 1. No channels at all, OR
// 2. Geoblocked with only Blocktank channels (treat as no usable channels)
let hasNoUsableChannels = (wallet.channelCount == 0) ||
(GeoService.shared.isGeoBlocked && !wallet.hasNonLspChannels())
return hasNoUsableChannels && cjitInvoice == nil && selectedTab == .spending
return !hasUsableChannels && cjitInvoice == nil && selectedTab == .spending
}

var body: some View {
Expand Down Expand Up @@ -109,7 +100,7 @@ struct ReceiveQr: View {
.foregroundColor(.purpleAccent),
isDisabled: wallet.nodeLifecycleState != .running
) {
if GeoService.shared.isGeoBlocked && !wallet.hasNonLspChannels() {
if GeoService.shared.isGeoBlocked && !hasUsableChannels {
navigationPath.append(.cjitGeoBlocked)
} else {
navigationPath.append(.cjitAmount)
Expand Down
Loading