File tree Expand file tree Collapse file tree
test/java/to/bitkit/repositories Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.first
2323import kotlinx.coroutines.flow.update
2424import kotlinx.serialization.SerialName
2525import kotlinx.serialization.Serializable
26- import kotlinx.serialization.encodeToString
2726import kotlinx.serialization.json.JsonObject
2827import kotlinx.serialization.json.JsonPrimitive
2928import 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,
Original file line number Diff line number Diff 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" )
Original file line number Diff line number Diff 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(
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments