From ef8fc96c8649db90d9f5b6c138db4e467bc1b083 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 12 Aug 2026 14:42:16 +0700 Subject: [PATCH] fix(dashpay): rekey isLocal consumers to the mine-or-tracked semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDK now defines isLocal as 'this identity is yours or deliberately tracked here': wallet-derived identities are always local, manual adds are local, and only incidental (observed) rows are false — with the persister promoting on wallet linkage and a startup heal for the constant-false era (dashpay/platform#4375). Update the three app-side readers written against the old dead 'Local Only / On Network' badge reading: - Identities list badge: the orange 'Local Only' badge (which would now appear on every wallet identity) becomes an 'Observed' badge on the rare incidental rows. - Identity detail sheet: the always-on Status row is replaced by an 'Observed' row shown only for incidental rows — the Wallet row already names the owner otherwise. - refreshFromNetwork: drop the '!row.isLocal' filter, which would have skipped exactly the wallet's own identities. The key-refresh gates stay on the wallet relationship (#981) — that operation needs the wallet's DIP-9 tree specifically, which isLocal deliberately does not claim. Land/pull dashpay/platform#4375 first: until then rows still carry the constant false and every identity shows the 'Observed' badge. Co-Authored-By: Claude Fable 5 --- .../Security/Wallets/IdentitiesScreen.swift | 27 ++++++++++++------- .../Wallets/IdentitiesViewModel.swift | 6 ++++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesScreen.swift b/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesScreen.swift index 1c76318ce..b0148baed 100644 --- a/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesScreen.swift +++ b/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesScreen.swift @@ -282,11 +282,14 @@ private struct IdentityRowView: View { icon: "server.rack", color: .indigo) } - if row.isLocal { + // `isLocal` = mine-or-tracked: wallet-derived identities + // are always local, manual adds too. Badge only the rare + // incidental rows (observed identities nobody tracks). + if !row.isLocal { IdentityBadge( - text: NSLocalizedString("Local Only", comment: "Identities"), - icon: "location", - color: .orange) + text: NSLocalizedString("Observed", comment: "Identities"), + icon: "eye", + color: .gray) } if row.pendingContestedName != nil { IdentityBadge( @@ -530,12 +533,16 @@ struct IdentityDetailScreen: View { detailRow( label: NSLocalizedString("Type", comment: "Identities"), value: typeName) - divider - detailRow( - label: NSLocalizedString("Status", comment: ""), - value: row.isLocal - ? NSLocalizedString("Local Only", comment: "Identities") - : NSLocalizedString("On Network", comment: "Identities")) + // A Status row only for the rare incidental case — every + // wallet identity is local, so an always-on "Local" row + // would be noise; the Wallet row below already names the + // owner when there is one. + if !row.isLocal { + divider + detailRow( + label: NSLocalizedString("Status", comment: ""), + value: NSLocalizedString("Observed", comment: "Identities")) + } if let walletName = row.walletName { divider detailRow( diff --git a/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesViewModel.swift b/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesViewModel.swift index ca05ea258..9171d5636 100644 --- a/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesViewModel.swift +++ b/DashWallet/Sources/UI/Menu/Security/Wallets/IdentitiesViewModel.swift @@ -229,7 +229,11 @@ final class IdentitiesViewModel: ObservableObject { } var failures = 0 - for row in rows where !row.isLocal { + // Refresh every row — the old `!row.isLocal` filter dates from + // when the flag was misread as an on-network badge; under the + // real semantics (mine-or-tracked) it would skip exactly the + // wallet's own identities. + for row in rows { do { let fetched = try await sdk.identityGet(identityId: row.idBase58) if let balance = Self.uint64(from: fetched["balance"]) {