Skip to content

Commit 64e7c96

Browse files
authored
Merge branch 'master' into fix/node-stopping-bg-payments
2 parents a5070bc + 5140f2a commit 64e7c96

6 files changed

Lines changed: 9 additions & 18 deletions

File tree

app/src/main/java/to/bitkit/repositories/BackupRepo.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,8 @@ class BackupRepo @Inject constructor(
546546
}
547547

548548
Logger.info("Full restore success", context = TAG)
549+
}.onSuccess {
550+
settingsStore.update { it.copy(backupVerified = true) }
549551
}.onFailure { e ->
550552
Logger.warn("Full restore error", e = e, context = TAG)
551553
}

app/src/main/java/to/bitkit/repositories/WalletRepo.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ class WalletRepo @Inject constructor(
300300
keychain.saveString(Keychain.Key.BIP39_PASSPHRASE.name, bip39Passphrase)
301301
}
302302
setWalletExistsState()
303-
}.onSuccess {
304-
settingsStore.update { it.copy(backupVerified = true) }
305303
}.onFailure {
306304
Logger.error("restoreWallet error", it, context = TAG)
307305
}

app/src/main/java/to/bitkit/services/MigrationService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.first
2323
import kotlinx.coroutines.flow.update
2424
import kotlinx.serialization.SerialName
2525
import kotlinx.serialization.Serializable
26-
import kotlinx.serialization.encodeToString
2726
import kotlinx.serialization.json.JsonObject
2827
import kotlinx.serialization.json.JsonPrimitive
2928
import kotlinx.serialization.json.buildJsonObject
@@ -1212,6 +1211,8 @@ class MigrationService @Inject constructor(
12121211
val bitkitFiles = rnBackupClient.listFiles(fileGroup = "bitkit")?.list ?: emptyList()
12131212
retrieveAndApplyBitkitBackups(bitkitFiles)
12141213
markMigrationCompleted()
1214+
}.onSuccess {
1215+
settingsStore.update { it.copy(backupVerified = true) }
12151216
}.onFailure { e ->
12161217
Logger.error("RN remote backup restore failed", e, context = TAG)
12171218
throw e
@@ -1419,6 +1420,7 @@ class MigrationService @Inject constructor(
14191420
Logger.warn("Paid order $orderId not found in fetched orders", context = TAG)
14201421
null
14211422
}
1423+
14221424
order.state2 == com.synonym.bitkitcore.BtOrderState2.EXECUTED -> null
14231425
else -> TransferEntity(
14241426
id = txId,

app/src/main/java/to/bitkit/ui/sheets/NewTransactionSheet.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ fun NewTransactionSheetView(
156156

157157
BalanceHeaderView(
158158
sats = details.sats,
159-
onClick = onDetailClick,
160159
modifier = Modifier
161160
.fillMaxWidth()
162161
.testTag("ReceivedTransaction")
@@ -174,8 +173,7 @@ fun NewTransactionSheetView(
174173
SecondaryButton(
175174
text = stringResource(R.string.wallet__send_details),
176175
onClick = onDetailClick,
177-
enabled = details.paymentHashOrTxId != null,
178-
isLoading = details.isLoadingDetails,
176+
enabled = details.paymentHashOrTxId != null && !details.isLoadingDetails,
179177
modifier = Modifier
180178
.weight(1f)
181179
.testTag("Details")

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,10 +1591,12 @@ class AppViewModel @Inject constructor(
15911591
direction = NewTransactionSheetDirection.SENT,
15921592
paymentHashOrTxId = txId,
15931593
sats = amount.toLong(),
1594+
isLoadingDetails = true,
15941595
)
15951596
)
15961597
lightningRepo.sync()
15971598
activityRepo.syncActivities()
1599+
_successSendUiState.update { it.copy(isLoadingDetails = false) }
15981600
}.onFailure { e ->
15991601
Logger.error(msg = "Error sending onchain payment", e = e, context = TAG)
16001602
toast(

app/src/test/java/to/bitkit/repositories/WalletRepoTest.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,13 @@ class WalletRepoTest : BaseUnitTest() {
167167
}
168168

169169
@Test
170-
fun `restoreWallet should set backupVerified to true on success`() = test {
170+
fun `restoreWallet should not call settingsStore`() = test {
171171
val mnemonic = "restore mnemonic"
172172
whenever(keychain.saveString(any(), any())).thenReturn(Unit)
173173

174174
val result = sut.restoreWallet(mnemonic, null)
175175

176176
assertTrue(result.isSuccess)
177-
verify(settingsStore).update(any())
178-
}
179-
180-
@Test
181-
fun `restoreWallet should not set backupVerified when keychain fails`() = test {
182-
val mnemonic = "restore mnemonic"
183-
whenever(keychain.saveString(any(), any())).thenThrow(error)
184-
185-
val result = sut.restoreWallet(mnemonic, null)
186-
187-
assertTrue(result.isFailure)
188177
verify(settingsStore, never()).update(any())
189178
}
190179

0 commit comments

Comments
 (0)