@@ -121,9 +121,8 @@ class WalletRepo @Inject constructor(
121121 emptyList()
122122 }
123123
124- val (_, shouldBlockLightningReceive) = coreService.checkGeoBlock()
125124 _walletState .update {
126- it.copy(receiveOnSpendingBalance = ! shouldBlockLightningReceive )
125+ it.copy(isGeoBlocked = coreService.isGeoBlocked() )
127126 }
128127 clearBip21State(clearTags = false )
129128 refreshAddressIfNeeded()
@@ -429,16 +428,6 @@ class WalletRepo @Inject constructor(
429428 }
430429 }
431430
432- suspend fun toggleReceiveOnSpendingBalance (): Result <Unit > = withContext(bgDispatcher) {
433- if (! _walletState .value.receiveOnSpendingBalance && coreService.checkGeoBlock().second) {
434- return @withContext Result .failure(ServiceError .GeoBlocked )
435- }
436-
437- _walletState .update { it.copy(receiveOnSpendingBalance = ! it.receiveOnSpendingBalance) }
438-
439- return @withContext Result .success(Unit )
440- }
441-
442431 // Payment ID management
443432 private suspend fun paymentHash (): String? = withContext(bgDispatcher) {
444433 val bolt11 = getBolt11()
@@ -553,7 +542,7 @@ class WalletRepo @Inject constructor(
553542 setBip21Description(description)
554543
555544 val canReceive = lightningRepo.canReceive()
556- if (canReceive && _walletState .value.receiveOnSpendingBalance ) {
545+ if (canReceive) {
557546 lightningRepo.createInvoice(amountSats, description).onSuccess {
558547 setBolt11(it)
559548 }
@@ -575,9 +564,7 @@ class WalletRepo @Inject constructor(
575564
576565 suspend fun shouldRequestAdditionalLiquidity (): Result <Boolean > = withContext(bgDispatcher) {
577566 return @withContext try {
578- if (! _walletState .value.receiveOnSpendingBalance) return @withContext Result .success(false )
579-
580- if (coreService.checkGeoBlock().first) return @withContext Result .success(false )
567+ if (coreService.isGeoBlocked()) return @withContext Result .success(false )
581568
582569 val channels = lightningRepo.lightningState.value.channels
583570 if (channels.filterOpen().isEmpty()) return @withContext Result .success(false )
@@ -617,7 +604,7 @@ data class WalletState(
617604 val bip21AmountSats : ULong? = null ,
618605 val bip21Description : String = " " ,
619606 val selectedTags : List <String > = listOf(),
620- val receiveOnSpendingBalance : Boolean = true ,
607+ val isGeoBlocked : Boolean = false ,
621608 val walletExists : Boolean = false ,
622609)
623610
0 commit comments