Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
e823cf8
fix: decouple wallet restore from profile refresh
ben-kaufman Oct 24, 2026
ec20b26
docs: associate restore note with PR 1121
ben-kaufman Oct 24, 2026
0dc56a0
fix: stop automatic profile deletion replay
ben-kaufman Oct 24, 2026
1b8a6db
docs: associate deletion fix with PR 1122
ben-kaufman Oct 24, 2026
f204e05
fix: serialize backup observation lifecycle
ben-kaufman Oct 25, 2026
be554fc
Merge backup lifecycle repair into profile deletion recovery
ben-kaufman Oct 25, 2026
538f45c
fix: retain backup changes during observation restart
ben-kaufman Oct 25, 2026
d1745fb
Merge backup restart recovery into profile deletion fix
ben-kaufman Oct 25, 2026
1ad665f
test: wait for unobstructed USDT back navigation
ben-kaufman Oct 25, 2026
8d4ed2b
fix: stop profile deletion after incomplete cleanup
ben-kaufman Oct 25, 2026
76e0f80
chore: rename changelog fragment
ben-kaufman Oct 25, 2026
a062618
fix: preserve sessions after uncertain profile deletion
ben-kaufman Oct 25, 2026
6577437
Merge parent UI synchronization into profile deletion fix
ben-kaufman Oct 25, 2026
ca10ace
test: retain navigation timeout evidence
ben-kaufman Oct 25, 2026
2fee532
fix: reject stale SDK waiters before wipe enqueue
ben-kaufman Oct 26, 2026
3a7210b
chore: rename changelog fragment
ben-kaufman Oct 26, 2026
494c949
fix: retry backup transport failures and coalesce status writes
ben-kaufman Oct 26, 2026
ff999a5
fix: complete wallet initialization once
ben-kaufman Oct 26, 2026
61e74dc
fix: recover connections during wallet restore
ben-kaufman Oct 26, 2026
9481b50
docs: number connection recovery changelog
ben-kaufman Oct 26, 2026
39fcaec
Merge current ordinary-wallet parent into restore identity recovery
ben-kaufman Oct 27, 2026
2416046
merge: adopt current recovery dependency stack
ben-kaufman Oct 27, 2026
754a899
fix: serialize backup observer cancellable mutations
ben-kaufman Oct 27, 2026
14152f4
Merge current identity recovery parent
ben-kaufman Oct 27, 2026
868ef74
fix: complete guarded connection recovery
ben-kaufman Oct 27, 2026
93181d5
Merge validated backup lifecycle parent
ben-kaufman Oct 27, 2026
d66019e
Merge backup lifecycle parent into profile deletion recovery
ben-kaufman Oct 27, 2026
7f54d7b
Align profile recovery with current parent ancestry
ben-kaufman Oct 27, 2026
7e172c6
Merge current profile recovery parent
ben-kaufman Oct 27, 2026
8592e58
Merge validated profile cleanup parent
ben-kaufman Oct 27, 2026
bfc4a5e
fix: retain backup changes while stopped uploads drain
ben-kaufman Oct 27, 2026
73b7d58
Merge updated ordinary wallet parent into identity recovery
ben-kaufman Oct 27, 2026
e12df99
Merge restore parent and preserve foreground backup lifecycle
ben-kaufman Oct 27, 2026
162ea52
Merge validated foreground backup parent
ben-kaufman Oct 27, 2026
f3222bf
Merge validated backup lifecycle parent into connection recovery
ben-kaufman Oct 27, 2026
c18e747
Merge latest profile recovery parent
ben-kaufman Oct 27, 2026
6c0a160
Merge validated profile cleanup parent into SDK queue fix
ben-kaufman Oct 27, 2026
911f24c
fix: preserve readiness after activity sync errors
ben-kaufman Oct 27, 2026
e7d5595
fix: defer wallet creation while offline
ben-kaufman Oct 28, 2026
753d6d1
docs: condense recovery changelog entry
ben-kaufman Oct 28, 2026
c0b1e86
Merge validated ordinary-wallet parent into restore identity recovery
ben-kaufman Oct 28, 2026
566b2ff
merge validated backup identity parent
ben-kaufman Oct 28, 2026
f3df6cd
merge validated backup lifecycle parent
ben-kaufman Oct 28, 2026
c26d7b1
Merge current profile recovery parent
ben-kaufman Oct 28, 2026
be804c7
Merge current restore recovery parent
ben-kaufman Oct 28, 2026
3f88708
Merge current profile cleanup parent
ben-kaufman Oct 28, 2026
0b77f09
fix: retry missing profiles after reconnect
ben-kaufman Oct 28, 2026
a2b2186
fix: refuse profile removal with active subscriptions
ben-kaufman Oct 29, 2026
ef1286d
Merge active-subscription cleanup safeguards into SDK queue fix
ben-kaufman Oct 29, 2026
2d4fc71
Merge current ordinary-wallet parent into identity recovery
ben-kaufman Oct 29, 2026
d33547c
Merge current identity recovery parent into backup lifecycle
ben-kaufman Oct 29, 2026
940d7f3
Merge current backup lifecycle parent into profile deletion
ben-kaufman Oct 29, 2026
6665a44
Explain finite subscription expiration before profile removal
ben-kaufman Oct 29, 2026
1f8e07e
Merge current backup lifecycle parent into connection recovery
ben-kaufman Oct 29, 2026
2df5bad
Merge current profile deletion parent into acknowledged cleanup
ben-kaufman Oct 29, 2026
35e267d
Merge current profile cleanup parent into atomic SDK queue
ben-kaufman Oct 29, 2026
a4f5ca6
fix: drain node event listeners before retry
ben-kaufman Oct 29, 2026
d0246d1
Merge current ordinary-wallet parent into identity recovery
ben-kaufman Oct 29, 2026
8947f49
Merge current identity parent while preserving backup drains
ben-kaufman Oct 29, 2026
f38c33e
Merge backup parent and preserve weak node-release checks
ben-kaufman Oct 29, 2026
bee8975
Merge validated backup parent into profile deletion recovery
ben-kaufman Oct 29, 2026
b14d5a1
Merge validated deletion parent into strict profile cleanup
ben-kaufman Oct 29, 2026
53b67b0
Merge validated cleanup parent into atomic SDK admission
ben-kaufman Oct 29, 2026
1dd6d2f
test: isolate identity publication return deadline
ben-kaufman Oct 29, 2026
d896dba
Merge current parent guards into restored identity recovery
ben-kaufman Oct 30, 2026
262a447
Merge wallet recovery ordering into backup lifecycle guards
ben-kaufman Oct 30, 2026
ca3dc95
Merge backup lifecycle guards into connection recovery
ben-kaufman Oct 30, 2026
49f88a0
Merge backup lifecycle guards into profile session recovery
ben-kaufman Oct 30, 2026
de683f3
Merge current deletion recovery parent into profile cleanup
ben-kaufman Oct 30, 2026
6dca681
chore: merge current profile cleanup recovery
ben-kaufman Oct 30, 2026
e5143b1
fix: skip profile recovery while setup is pending
ben-kaufman Oct 31, 2026
13b9119
fix: wait for node startup before stopping
ben-kaufman Oct 31, 2026
624d7a3
Merge current ordinary-wallet parent into identity recovery
ben-kaufman Oct 31, 2026
fb25166
Merge validated restore identity parent into backup lifecycle recovery
ben-kaufman Oct 31, 2026
a6647db
Merge validated backup lifecycle parent
ben-kaufman Oct 31, 2026
f8bd749
Merge updated backup lifecycle parent into connection recovery
ben-kaufman Oct 31, 2026
dd180c6
Merge validated deletion parent into profile cleanup
ben-kaufman Oct 31, 2026
7e0c8e5
chore: merge validated profile cleanup parent
ben-kaufman Oct 31, 2026
d83a217
Merge queued allowance admission fix
ben-kaufman Nov 1, 2026
2c0c100
Merge queued allowance admission fix
ben-kaufman Nov 1, 2026
2f80b44
Merge queued allowance admission into profile recovery
ben-kaufman Nov 1, 2026
89e5e94
Merge current backup lifecycle into connection recovery
ben-kaufman Nov 1, 2026
a6f233d
Merge corrected channel-close and current billing fixtures
ben-kaufman Nov 1, 2026
1cd0730
Merge validated restore parent while preserving cleanup composition
ben-kaufman Nov 1, 2026
ff3ba67
Merge current restore identity parent into backup lifecycle
ben-kaufman Nov 1, 2026
5a5044a
Merge validated backup parent into restore identity recovery
ben-kaufman Nov 1, 2026
4637d91
fix: retain connection recovery after failed startup retry
ben-kaufman Nov 1, 2026
3991f3a
merge: incorporate validated profile recovery parent
ben-kaufman Nov 1, 2026
3f90df9
Merge current profile cleanup and allowance admission
ben-kaufman Nov 1, 2026
b9f3bbd
fix: preserve backups when cached channel reads fail
ben-kaufman Nov 3, 2026
c633688
merge: carry cached backup protection into observer recovery
ben-kaufman Nov 3, 2026
2d60492
merge: preserve cached backups during session recovery
ben-kaufman Nov 3, 2026
e8aaa4b
merge: preserve cached backups during profile cleanup
ben-kaufman Nov 3, 2026
34925fb
Merge cached backup read protection and use explicit paste in profile…
ben-kaufman Nov 3, 2026
14ce885
Merge cached backup read protection and use explicit paste in profile…
ben-kaufman Nov 3, 2026
4e6c06e
fix: publish backup idle after scheduled admission cleanup
ben-kaufman Nov 3, 2026
595898e
Merge scheduled backup completion fix into profile session recovery
ben-kaufman Nov 3, 2026
85db6cf
Merge scheduled backup completion fix into connection recovery
ben-kaufman Nov 3, 2026
ce0784b
Merge scheduled backup completion fix into profile cleanup
ben-kaufman Nov 3, 2026
9fbc9e0
Merge scheduled backup completion fix into SDK wipe queue
ben-kaufman Nov 3, 2026
11fb65d
fix: retry temporary backup authentication failures
ben-kaufman Nov 3, 2026
b44f025
merge: compose backup auth recovery and clipboard fixture
ben-kaufman Nov 3, 2026
5063625
merge: compose backup authentication transport recovery
ben-kaufman Nov 3, 2026
21d6a22
merge: compose backup authentication transport recovery
ben-kaufman Nov 3, 2026
5f5fcf5
merge: compose backup authentication transport recovery
ben-kaufman Nov 3, 2026
25f25ea
fix: drain VSS calls before replacing wallet clients
ben-kaufman Nov 4, 2026
c75acf3
fix: prevent backup requests from crossing wallet removal
ben-kaufman Nov 4, 2026
bf4061f
Merge wallet wipe recovery and wait for VSS retirement
ben-kaufman Nov 4, 2026
eb959e4
Merge VSS ownership parent before durable wipe integration
ben-kaufman Nov 4, 2026
7919401
Merge VSS ownership parent before durable wipe integration
ben-kaufman Nov 4, 2026
f514d19
Merge durable wipe recovery into backup observation lifecycle
ben-kaufman Nov 4, 2026
85a87f0
Merge durable wipe recovery into profile deletion recovery
ben-kaufman Nov 4, 2026
d8fa381
Merge durable wipe recovery into connection recovery
ben-kaufman Nov 4, 2026
063bdef
Merge durable wipe recovery into profile cleanup
ben-kaufman Nov 4, 2026
39ecf15
Merge durable wipe recovery into SDK queue ownership
ben-kaufman Nov 5, 2026
485a9dc
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
003ea7e
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
2079437
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
4d265af
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
6de9ad9
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
6306930
Merge expired wallet cleanup admission fix
ben-kaufman Nov 5, 2026
154326a
fix: bound wipe drain waits and isolate event acknowledgements
ben-kaufman Nov 5, 2026
fb8cddb
test: await both Jade connection teardown effects
ben-kaufman Nov 5, 2026
111ddd8
Merge current master into identity recovery
ben-kaufman Nov 5, 2026
5cae328
Merge identity recovery into backup lifecycle
ben-kaufman Nov 5, 2026
c80a599
Merge validated backup parent into identity recovery
ben-kaufman Nov 5, 2026
1c3cde6
fix: resume metadata backup after wallet recovery
ben-kaufman Nov 5, 2026
675f8bd
Merge metadata recovery into backup lifecycle
ben-kaufman Nov 5, 2026
a214b06
Merge metadata recovery into profile deletion
ben-kaufman Nov 5, 2026
8eadf2b
Merge metadata recovery into connection lifecycle
ben-kaufman Nov 5, 2026
1491b85
Merge metadata recovery into profile cleanup
ben-kaufman Nov 5, 2026
814a837
Merge metadata recovery into SDK wipe queue
ben-kaufman Nov 6, 2026
eff0dad
fix: preserve backup work across observation restarts
ben-kaufman Nov 6, 2026
61537eb
Merge backup restart recovery into ordered observation lifecycle
ben-kaufman Nov 6, 2026
0ad5541
test: wait for the USDT quote before navigating back
ben-kaufman Nov 6, 2026
5f8a226
fix: retry pending backups after VSS setup times out
ben-kaufman Nov 9, 2026
6c40b8d
test: defer optional update prompts in wallet UI fixtures
ben-kaufman Nov 9, 2026
b0e2349
Merge master recovery updates into backup recovery
ben-kaufman Nov 13, 2026
0161e63
Merge current master into restored identity recovery
ben-kaufman Nov 13, 2026
b6306aa
fix: retain observed backup changes through shutdown
ben-kaufman Nov 13, 2026
66ed742
Merge pull request #1123 from synonymdev/fix/backup-observer-lifecycle
ovitrif Nov 26, 2026
5f49dea
Merge pull request #1122 from synonymdev/fix/profile-delete-session-r…
ovitrif Nov 26, 2026
eafad85
Merge pull request #1125 from synonymdev/fix/paykit-sdk-wipe-queue
ovitrif Nov 26, 2026
a109a0e
chore: merge restore identity background into profile cleanup outcomes
ovitrif Nov 26, 2026
aeb5788
Merge pull request #1124 from synonymdev/fix/profile-cleanup-outcomes
ovitrif Nov 26, 2026
0d8e635
chore: merge restore identity background into restore connection reco…
ovitrif Nov 26, 2026
5caff9f
Merge pull request #1139 from synonymdev/fix/restore-connection-recovery
ovitrif Nov 26, 2026
4385a9d
chore: merge master into the stack
ovitrif Nov 26, 2026
038f115
fix: store the move-to-spark backup listener with the other listeners
ovitrif Nov 26, 2026
809f185
fix: keep the spark exit backup required during an active exit
ovitrif Nov 26, 2026
6975667
fix: cancel a backup run when its caller is cancelled before it resumes
ovitrif Nov 26, 2026
4c9d57d
fix: close review gaps in recovery, backups and wipe
ovitrif Nov 26, 2026
8c400aa
fix: stop the backup failure alert during an active spark exit
ovitrif Nov 27, 2026
c569d35
Merge remote-tracking branch 'origin/master' into fix/restore-identit…
ovitrif Nov 27, 2026
e624002
Merge remote-tracking branch 'origin/master' into fix/restore-identit…
ovitrif Nov 28, 2026
75da1b2
fix: raise the backup failure alert once the spark exit ends
ovitrif Nov 28, 2026
3af88ff
Merge remote-tracking branch 'origin/master' into fix/restore-identit…
ovitrif Dec 1, 2026
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
145 changes: 132 additions & 13 deletions Bitkit/AppScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ struct AppScene: View {
@State private var walletIsInitializing: Bool? = nil
@State private var isWalletBackupRestoreRunning = false
@State private var didWalletBackupRestoreFail = false
@ObservedObject private var connectionRecovery = ConnectionRecoveryService.shared
@State private var connectionEditor: ConnectionRecoveryService.Editor?
@State private var isPinVerified: Bool = false
@State private var showRecoveryScreen = false
/// Lets only a return from the background retry a failed node start, not a brief inactive phase.
Expand Down Expand Up @@ -1042,7 +1044,14 @@ struct AppScene: View {

@ViewBuilder
private var existingWalletContent: some View {
if walletIsInitializing == true {
if let connectionEditor, connectionRecovery.isCurrent(connectionEditor) {
WalletConnectionRecoveryView(
editor: connectionEditor,
onBack: { self.connectionEditor = nil },
onRetry: retryWalletStart,
recovery: connectionRecovery
)
} else if walletIsInitializing == true {
// New wallet is being created or restored
initializingContent
} else if wallet.isRestoringWallet {
Expand All @@ -1065,20 +1074,24 @@ struct AppScene: View {
@ViewBuilder
private var initializingContent: some View {
if didWalletBackupRestoreFail {
WalletRestoreError {
didWalletBackupRestoreFail = false
await restoreWalletBackupAndStart()
}
WalletRestoreError(onRetry: retryWalletStart, onConnectionSettings: connectionRecovery.isBusy ? nil : openConnectionRecovery)
} else if case .errorStarting = wallet.nodeLifecycleState {
WalletRestoreError(onRetry: retryWalletStart)
WalletRestoreError(onRetry: retryWalletStart, onConnectionSettings: connectionRecovery.isBusy ? nil : openConnectionRecovery)
} else {
let initializationLifecycle = connectionRecovery.lifecycleID
InitializingWalletView(nodeLifecycleState: $wallet.nodeLifecycleState) {
Logger.debug("Wallet finished initializing but node state is \(wallet.nodeLifecycleState)")

if wallet.nodeLifecycleState == .running {
if connectionRecovery.canFinishInitialization(
lifecycle: initializationLifecycle,
isRunning: wallet.nodeLifecycleState == .running,
hasPendingRestore: BackupService.shared.hasPendingWalletRestore(),
didFail: didWalletBackupRestoreFail
) {
walletIsInitializing = false
}
}
.id(connectionRecovery.isBusy)
Comment thread
ovitrif marked this conversation as resolved.
Resolved
}
}

Expand Down Expand Up @@ -1108,6 +1121,15 @@ struct AppScene: View {
}
}

private func openConnectionRecovery() {
guard !connectionRecovery.isBusy else { return }
do {
connectionEditor = try connectionRecovery.editor()
} catch {
app.toast(error)
}
}

private func handleWalletExistsChange(_: Bool?) {
Logger.info("Wallet exists state changed: \(wallet.walletExists?.description ?? "nil")")

Expand All @@ -1122,7 +1144,10 @@ struct AppScene: View {
}
}

guard wallet.walletExists == true, !wipeCoordinator.isGateUp else { return }
guard wallet.walletExists == true, !wipeCoordinator.isGateUp else {
connectionEditor = nil
return
}

// Don't start wallet if we're in recovery mode
guard !showRecoveryScreen else { return }
Expand All @@ -1138,7 +1163,7 @@ struct AppScene: View {
}

let shouldRestoreWalletBackup = wallet.isRestoringWallet || BackupService.shared.hasPendingWalletRestore()
if shouldRestoreWalletBackup {
if connectionRecovery.requiresRestrictedStartup(hasPendingRestore: shouldRestoreWalletBackup) {
walletIsInitializing = true
}

Expand Down Expand Up @@ -1166,7 +1191,26 @@ struct AppScene: View {
}
return
}
let lifecycle = connectionRecovery.lifecycleID
do {
try await connectionRecovery.perform(cancelsWithCaller: false) {
await startAdmittedWallet(completingBackupRestore: completingBackupRestore, playsErrorHaptic: playsErrorHaptic)
}
} catch ConnectionRecoveryService.AdmissionError.busy {
return
} catch {
guard !Task.isCancelled, connectionRecovery.isCurrentLifecycle(lifecycle) else { return }
Logger.error(error, context: "Wallet connection recovery")
didWalletBackupRestoreFail = true
walletIsInitializing = true
}
}

private func startAdmittedWallet(completingBackupRestore: Bool, playsErrorHaptic: Bool) async {
let hasPendingRestore = BackupService.shared.hasPendingWalletRestore()
if connectionRecovery.requiresRestrictedStartup(hasPendingRestore: hasPendingRestore) {
walletIsInitializing = true
}
guard !WalletBackupRestoreGate.blocksWalletStart(
isRestoreRunning: isWalletBackupRestoreRunning,
hasPendingRestore: hasPendingRestore,
Expand All @@ -1189,14 +1233,30 @@ struct AppScene: View {
}

do {
let revision = try connectionRecovery.replay()
if revision != nil, wallet.nodeLifecycleState != .stopped, wallet.nodeLifecycleState != .initializing {
try await wallet.stopLightningNode()
try connectionRecovery.checkCurrentOperation()
}
try await wallet.start()
guard !wipeCoordinator.isGateUp else { return }
try connectionRecovery.checkCurrentOperation()
try connectionRecovery.complete(revision: revision, hasPendingRestore: BackupService.shared.hasPendingWalletRestore(),
Comment thread
ovitrif marked this conversation as resolved.
Resolved
isRunning: wallet.nodeLifecycleState == .running)
{
didWalletBackupRestoreFail = false
connectionEditor = nil
}
try await activity.syncLdkNodePayments()

// Schedule full backup after wallet create/restore to prevent epoch dates in backup status
await BackupService.shared.scheduleFullBackup()
} catch {
guard connectionRecovery.canReportOperationFailure() else { return }
Logger.error(error, context: "Failed to start wallet")
if walletIsInitializing == true, connectionRecovery.canReportStartupFailure() {
didWalletBackupRestoreFail = true
}
if playsErrorHaptic {
Haptics.notify(.error)
}
Expand Down Expand Up @@ -1303,6 +1363,22 @@ struct AppScene: View {
}

private func restoreWalletBackupAndStart() async {
let lifecycle = connectionRecovery.lifecycleID
do {
try await connectionRecovery.perform(cancelsWithCaller: false) {
await restoreAdmittedWalletBackupAndStart()
}
} catch ConnectionRecoveryService.AdmissionError.busy {
return
} catch {
guard !Task.isCancelled, connectionRecovery.isCurrentLifecycle(lifecycle) else { return }
Logger.error(error, context: "Restore connection recovery")
didWalletBackupRestoreFail = true
walletIsInitializing = true
}
}

private func restoreAdmittedWalletBackupAndStart() async {
guard !isWalletBackupRestoreRunning, !wipeCoordinator.isGateUp else { return }
isWalletBackupRestoreRunning = true
walletIsInitializing = true
Expand All @@ -1314,14 +1390,22 @@ struct AppScene: View {
} else {
await restoreFromMostRecentBackup()
}
do {
try connectionRecovery.checkCurrentOperation()
} catch {
guard connectionRecovery.canReportOperationFailure() else { return }
didWalletBackupRestoreFail = true
app.toast(error)
return
}
guard didRestore else {
didWalletBackupRestoreFail = true
return
}

widgets.loadSavedWidgets()
widgets.objectWillChange.send()
await pubkyProfile.initialize()
pubkyProfile.scheduleInitializationAfterRestore()
await startWallet(completingBackupRestore: true)
restorePubkySwaps()
}
Expand Down Expand Up @@ -1357,12 +1441,45 @@ struct AppScene: View {
}

private func retryWalletStart() async {
let lifecycle = connectionRecovery.lifecycleID
do {
wallet.nodeLifecycleState = .initializing
try await wallet.start()
try wallet.setWalletExistsState()
try await connectionRecovery.perform(cancelsWithCaller: false) {
do {
walletIsInitializing = true
didWalletBackupRestoreFail = false
let needsRestore = wallet.isRestoringWallet || BackupService.shared.hasPendingWalletRestore()
if !needsRestore {
_ = try connectionRecovery.replay()
}
try await wallet.stopLightningNode()
try connectionRecovery.checkCurrentOperation()
if needsRestore || BackupService.shared.hasPendingWalletRestore() {
await restoreAdmittedWalletBackupAndStart()
} else {
await startAdmittedWallet(completingBackupRestore: false, playsErrorHaptic: true)
}
try connectionRecovery.checkCurrentOperation()
if connectionRecovery.canReportStartupFailure() {
didWalletBackupRestoreFail = true
}
if wallet.nodeLifecycleState == .running, !BackupService.shared.hasPendingWalletRestore(), !didWalletBackupRestoreFail {
connectionEditor = nil
}
} catch {
guard connectionRecovery.canReportOperationFailure() else { return }
walletIsInitializing = true
didWalletBackupRestoreFail = true
app.toast(error)
}
}
} catch ConnectionRecoveryService.AdmissionError.busy {
return
} catch {
guard !Task.isCancelled, connectionRecovery.isCurrentLifecycle(lifecycle) else { return }
walletIsInitializing = true
didWalletBackupRestoreFail = true
Logger.error("Failed to start wallet on retry", context: "AppScene")
app.toast(error)
Haptics.notify(.error)
}
}
Expand Down Expand Up @@ -1431,6 +1548,7 @@ struct AppScene: View {
try await BackupService.shared.restoreUsdtRecoveryAfterLegacyMigration()
return true
} catch {
guard connectionRecovery.canReportOperationFailure() else { return false }
app.toast(error)
return false
}
Expand All @@ -1444,6 +1562,7 @@ struct AppScene: View {
try await BackupService.shared.performFullRestoreFromLatestBackup()
return true
} catch {
guard connectionRecovery.canReportOperationFailure() else { return false }
app.toast(error)
return false
}
Expand Down
30 changes: 2 additions & 28 deletions Bitkit/Managers/ContactsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class ContactsManager: ObservableObject {
_ = try await PubkyService.removeContact(publicKey: $0)
},
removeContactRecords: @escaping @Sendable (_ publicKeys: [String]) async throws -> [ContactRecord] = {
try await PubkyService.removeContacts(publicKeys: $0)
try await PubkyService.removeContactsForProfile(publicKeys: $0)
},
forgetRemovedContacts: @escaping @Sendable (_ publicKeys: [String]) async -> Void = {
await PrivatePaykitService.shared.removeSavedContacts(publicKeys: $0)
Expand Down Expand Up @@ -990,22 +990,7 @@ class ContactsManager: ObservableObject {
stopPendingProfileLookups()
let contactRecords = contactRecords
let removeContactRecords = removeContactRecords
let records: [ContactRecord]
do {
records = try await Task.detached {
try await contactRecords()
}.value
} catch {
guard Self.isMissingContactsDataError(error) else {
throw error
}

Self.clearContactProfileOverrides()
await pruneUnsavedContactState([], nil)
contacts.removeAll()
Logger.info("Contacts storage missing, treating delete-all as empty", context: "ContactsManager")
return
}
let records = try await Task.detached { try await contactRecords() }.value

let keys = records.compactMap { PubkyPublicKeyFormat.normalized($0.publicKey) }
let removed = try await Task.detached { try await removeContactRecords(keys) }.value
Expand All @@ -1024,17 +1009,6 @@ class ContactsManager: ObservableObject {
Logger.info("Deleted all contacts", context: "ContactsManager")
}

func deleteAllContactsBestEffort() async {
do {
try await deleteAllContacts()
} catch {
Logger.warn("Continuing after contact cleanup failed: \(error)", context: "ContactsManager")
Self.clearContactProfileOverrides()
await pruneUnsavedContactState([], nil)
contacts.removeAll()
}
}

// MARK: - Remote Contact Discovery

/// Looks every follow's profile up on the interactive read lane: the user waits on the choice screen until the import
Expand Down
Loading
Loading