Skip to content

Commit 1d7bb69

Browse files
authored
Merge branch 'master' into fix/node-stopping-bg-payments
2 parents e559aef + cd71e00 commit 1d7bb69

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

app/src/main/java/to/bitkit/ui/screens/shop/shopDiscover/MapWebViewClient.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ class MapWebViewClient(
3838
)
3939
onLoadingStateChanged(false)
4040

41-
error?.let {
42-
if (it.errorCode == ERROR_HOST_LOOKUP ||
43-
it.errorCode == ERROR_CONNECT ||
44-
it.errorCode == ERROR_TIMEOUT ||
45-
it.errorCode == ERROR_FILE_NOT_FOUND
46-
) {
47-
onError?.invoke()
41+
if (request?.isForMainFrame == true) {
42+
error?.let {
43+
if (it.errorCode == ERROR_HOST_LOOKUP ||
44+
it.errorCode == ERROR_CONNECT ||
45+
it.errorCode == ERROR_TIMEOUT ||
46+
it.errorCode == ERROR_FILE_NOT_FOUND
47+
) {
48+
onError?.invoke()
49+
}
4850
}
4951
}
5052
}

app/src/main/java/to/bitkit/ui/screens/shop/shopWebView/ShopWebViewClient.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ class ShopWebViewClient(
6262
)
6363
onLoadingStateChanged(false)
6464

65-
error?.let {
66-
if (it.errorCode == ERROR_HOST_LOOKUP ||
67-
it.errorCode == ERROR_CONNECT ||
68-
it.errorCode == ERROR_TIMEOUT ||
69-
it.errorCode == ERROR_FILE_NOT_FOUND
70-
) {
71-
onError()
65+
if (request?.isForMainFrame == true) {
66+
error?.let {
67+
if (it.errorCode == ERROR_HOST_LOOKUP ||
68+
it.errorCode == ERROR_CONNECT ||
69+
it.errorCode == ERROR_TIMEOUT ||
70+
it.errorCode == ERROR_FILE_NOT_FOUND
71+
) {
72+
onError()
73+
}
7274
}
7375
}
7476
}

app/src/main/java/to/bitkit/ui/settings/lightning/LightningConnectionsViewModel.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ import to.bitkit.ext.createChannelDetails
3232
import to.bitkit.ext.filterOpen
3333
import to.bitkit.ext.filterPending
3434
import to.bitkit.models.Toast
35+
import to.bitkit.models.TransferType
3536
import to.bitkit.repositories.ActivityRepo
3637
import to.bitkit.repositories.BlocktankRepo
3738
import to.bitkit.repositories.LightningRepo
3839
import to.bitkit.repositories.LogsRepo
40+
import to.bitkit.repositories.TransferRepo
3941
import to.bitkit.repositories.WalletRepo
4042
import to.bitkit.ui.shared.toast.ToastEventBus
4143
import to.bitkit.utils.Logger
@@ -51,6 +53,7 @@ class LightningConnectionsViewModel @Inject constructor(
5153
private val logsRepo: LogsRepo,
5254
private val walletRepo: WalletRepo,
5355
private val activityRepo: ActivityRepo,
56+
private val transferRepo: TransferRepo,
5457
) : ViewModel() {
5558

5659
private val _uiState = MutableStateFlow(LightningConnectionsUiState())
@@ -452,6 +455,12 @@ class LightningConnectionsViewModel @Inject constructor(
452455

453456
lightningRepo.closeChannel(channel).fold(
454457
onSuccess = {
458+
transferRepo.createTransfer(
459+
type = TransferType.COOP_CLOSE,
460+
amountSats = channel.amountOnClose.toLong(),
461+
channelId = channel.channelId,
462+
fundingTxId = channel.fundingTxo?.txid,
463+
)
455464
walletRepo.syncNodeAndWallet()
456465

457466
ToastEventBus.send(

0 commit comments

Comments
 (0)