From aecbb3b336678cd6a0d57bc0e9301f3d6c678824 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:04:48 +0300 Subject: [PATCH 1/4] fix(dashpay): repair the invitation-claim aftermath and rebuild the banner as a menu row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claiming an invitation and registering a non-contested username left the app in three wrong states, all with the same tell: a relaunch fixed them. 1. The user landed back on "Claim your invitation" — the screen they had just completed and cannot repeat. `CreateUsernameViewController` popped one level, and the invitation entry pushes the form ON TOP of the redeem screen. It now unwinds to the tab's root. 2. The DashPay tabs stayed at three instead of five, and the More screen kept offering "Join DashPay". Both follow from the same break: `CreateUsernameViewModel`'s invitation branch calls the coordinator directly and never touches `DWIdentityRegistrationBridge.shared`. That singleton is the only poster of the canonical registration notification, and it wires itself up in its own lazy `init` — so on an invitation-first launch (the normal case: invitations exist to onboard new users) it is never constructed and the notification is never posted at all. Nothing told the tab bar, the banner or `DWCurrentUserIdentityInfo` that registration had happened. The branch now announces it explicitly, the same way `reconcileRecoveredIdentity()` does for identities that arrive outside the bridge's flow. `MainTabbarController.applyPendingDashPayTabReconfiguration` additionally gated on a flag that `reconfigureDashPayTabsIfNeeded` only raises after it has already seen an identity — so when the notification landed before `DWCurrentUserIdentityInfo` could see the new row, the flag stayed false and the tabs were never rebuilt. It no longer depends on that flag; the rebuild is idempotent. The Join DashPay banner is now a standard menu row on both Home and More. The Hide / Upgrade buttons are gone: the row itself is the action, and a trailing close control appears only on Home, where the banner is an interruption. On More it is a standing menu entry, so it is no longer hidden by the dismissal flag (one tap on Home's close used to remove it there permanently, with no way to bring it back) and no longer gated on sync — it stays put while the chain catches up, presenting itself as unavailable instead of vanishing. State-to-copy mapping moved into `JoinDashPayCopy` so the two surfaces cannot drift. The row's tap needed its own handler rather than the old action button's: `.callToAction` reached `editProfile()`, which guards on an existing identity and returns silently for exactly the users that state describes — a dead row. --- .../Usernames/CurrentUserProfileModel.swift | 25 +- .../CreateUsernameViewController.swift | 9 +- .../CreateUsernameViewModel.swift | 16 + .../CreateUsername/JoinDashPayView.swift | 292 ++++++++++++------ .../Sources/UI/Home/Views/HomeView.swift | 27 +- .../UI/Main/MainTabbarController.swift | 12 +- .../UI/Menu/Main/MainMenuViewController.swift | 44 ++- .../UI/Menu/Main/MainMenuViewModel.swift | 5 + DashWallet/en.lproj/Localizable.strings | 3 + 9 files changed, 304 insertions(+), 129 deletions(-) diff --git a/DashWallet/Sources/Models/Usernames/CurrentUserProfileModel.swift b/DashWallet/Sources/Models/Usernames/CurrentUserProfileModel.swift index 5df6bbd35b..c623ecedcb 100644 --- a/DashWallet/Sources/Models/Usernames/CurrentUserProfileModel.swift +++ b/DashWallet/Sources/Models/Usernames/CurrentUserProfileModel.swift @@ -33,7 +33,11 @@ class CurrentUserProfileModel: NSObject, ObservableObject { @objc private(set) var state: CurrentUserProfileModelState = .none @objc let updateModel: DWDPUpdateProfileModel @Published private(set) var showJoinDashpay: Bool = false - + /// Chain still catching up. The Join DashPay row stays visible throughout + /// (it is a standing menu entry) but presents itself as unavailable: + /// registration cannot be started until the chain is synced. + @Published private(set) var isSyncing: Bool = false + override init() { updateModel = DWDPUpdateProfileModel() super.init() @@ -41,7 +45,8 @@ class CurrentUserProfileModel: NSObject, ObservableObject { model.$state .removeDuplicates() .receive(on: DispatchQueue.main) - .sink { [weak self] _ in + .sink { [weak self] state in + self?.isSyncing = state != .syncDone self?.updateShowJoinDashpay() } .store(in: &cancellableBag) @@ -106,8 +111,20 @@ class CurrentUserProfileModel: NSObject, ObservableObject { } showJoinDashpay = JoinDashPayBannerPolicy.shouldShow( contextReady: identityState.contextReady, - syncDone: model.state == .syncDone, - dismissed: UsernamePrefs.shared.joinDashPayDismissed, + // Not gated on sync. The More entry is a standing menu row, and + // gating it made it come and go depending on how far the chain + // had caught up — the row was simply absent for the whole of a + // long sync. Registration itself still needs a synced chain; the + // row reflects that in its own copy rather than by vanishing. + syncDone: true, + // Deliberately not `UsernamePrefs.shared.joinDashPayDismissed`. + // That flag is set by the close control, which exists only on + // Home — the More entry has no dismiss affordance at all. Reading + // it here meant one tap on Home's close permanently removed the + // menu entry too, with no way for the user to bring it back. + // On More the banner is a standing menu row: it disappears when + // the user actually has a username, not when they dismiss it. + dismissed: false, hasRegisteredUsername: hasUsername, hasRegistrationInProgress: hasPendingRecoveredName) } diff --git a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewController.swift b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewController.swift index 98ff9c61c0..411f566432 100644 --- a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewController.swift +++ b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewController.swift @@ -63,7 +63,14 @@ class CreateUsernameViewController: UIViewController { #if DASHPAY let mainTabController = self.tabBarController as? MainTabbarController #endif - navigationController?.popViewController(animated: true) + // Pop the whole registration stack, not one level. The invitation + // entry pushes this screen ON TOP of the redeem screen, so popping + // once lands the freshly-registered user back on "Claim your + // invitation" — a flow they just completed and cannot repeat. + // Every push site roots this flow at a tab's own screen, so + // unwinding to that root is the correct destination for all of + // them (Home for the home/deep-link entries, More for the menu). + navigationController?.popToRootViewController(animated: true) self.completionHandler?(true) #if DASHPAY if let transitionCoordinator = navigationController?.transitionCoordinator { diff --git a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift index 7103b4f4b0..7a12c5b6a4 100644 --- a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift +++ b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift @@ -382,6 +382,22 @@ class CreateUsernameViewModel: ObservableObject { username: submittedUsername, invitationURI: invitationURI, temporaryUsername: temporaryUsername) + // This path never touches `DWIdentityRegistrationBridge.shared`, + // so on an invitation-first launch that singleton is never + // constructed, never observes the coordinator's phases, and + // never posts the canonical registration notification — + // `.shared` and `.stateChangedNotification` are independently + // lazy statics, so referencing the notification name does not + // build the bridge. Every consumer of app-wide "registered now" + // state (the DashPay tab set, the More screen's Join DashPay + // banner, `DWCurrentUserIdentityInfo`'s cached snapshot) then + // kept its pre-registration value until the next launch rebuilt + // it from disk. Announce it explicitly here, the same way + // `DWCurrentUserIdentityInfo.reconcileRecoveredIdentity()` does + // for identities that arrive outside the bridge's flow. + DWCurrentUserIdentityInfo.shared.refreshFromSDK() + NotificationCenter.default.post( + name: .DWDashPayRegistrationStatusUpdated, object: nil) return registrationOutcome(for: submittedUsername) } catch DWIdentityRegistrationCoordinator.CoordinatorError.authCancelled { return .cancelled diff --git a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift index 0236b1cdae..13fe1560fb 100644 --- a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift +++ b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift @@ -35,82 +35,20 @@ extension JoinDashPayState { } } -struct JoinDashPayView: View { - @StateObject var viewModel: JoinDashPayViewModel - /// Drives the `.callToAction` subtitle nudge: the banner is the - /// earliest surface where "fund your Shielded balance now, register - /// in a few hours" can reach the user, so the copy tracks the - /// shielded readiness state (add funds → maturing countdown → ready). - @ObservedObject private var shieldedReadiness = ShieldedIdentityFundingReadiness.shared - var onTap: (JoinDashPayState) -> Void - var onActionButton: ((JoinDashPayState) -> Void)? = nil - var onDismissButton: ((JoinDashPayState) -> Void)? = nil - var onSizeChange: ((CGSize) -> Void)? = nil - - var body: some View { - VStack(spacing: 0) { - HStack(alignment: .center, spacing: 12) { - Image(leadingIconName) - .padding(.horizontal, 10) - - VStack(alignment: .leading, spacing: 2) { - Text(titleText) - .font(.subheadline) - .fontWeight(.medium) - .fixedSize(horizontal: false, vertical: true) - .foregroundColor(.dash.primaryText) - .multilineTextAlignment(.leading) - - if viewModel.state != .registered { - Text(subtitleText) - .font(.footnote) - .foregroundColor(.dash.tertiaryText) - .fixedSize(horizontal: false, vertical: true) - .multilineTextAlignment(.leading) - .padding(.top, 2) - } - } - .frame(maxWidth: .infinity, alignment: .leading) - } - - if viewModel.state.hasAction() { - ButtonsGroup( - orientation: .horizontal, - size: .small, - positiveButtonText: actionButtonText, - positiveButtonIcon: actionButtonIcon, - positiveButtonAction: { - onActionButton?(viewModel.state) - }, - negativeButtonText: NSLocalizedString("Hide", comment: ""), - negativeButtonAction: { - onDismissButton?(viewModel.state) - } - ).padding(.top, 15) - .padding(.trailing, 10) - } - } - .padding(.vertical, 15) - .padding(.leading, 15) - .padding(.trailing, 5) - .background( - GeometryReader { geometry in - onSizeChange?(geometry.size) - return Color.dash.secondaryBackground - } - ) - .cornerRadius(8) - .shadow(color: .shadow, radius: 10, x: 0, y: 5) - .onTapGesture { - onTap(viewModel.state) - } - .onAppear { - viewModel.checkUsername() - } - } - - private var leadingIconName: String { - switch viewModel.state { +/// State → banner copy for the Join DashPay surfaces. Holds the inputs the +/// copy depends on and nothing else, so both call sites of +/// `JoinDashPayMenuItem` (Home and More) render identical text from one place. +/// +/// `@MainActor` because the voting subtitle reads +/// `DWContestedNameStatusService.shared`, which is main-actor isolated. +@MainActor +struct JoinDashPayCopy { + let state: JoinDashPayState + let username: String + let shieldedSnapshot: ShieldedIdentityFundingReadiness.Snapshot? + + var iconName: String { + switch state { case .none, .callToAction, .registered: return "dp_user_generic" case .voting: @@ -121,15 +59,15 @@ struct JoinDashPayView: View { return "username_rejected" } } - - private var titleText: String { - switch viewModel.state { + + var title: String { + switch state { case .none: return NSLocalizedString("Join DashPay", comment: "") case .callToAction: return NSLocalizedString("Upgrade to DashPay", comment: "") case .voting, .registered: - return viewModel.username + return username case .approved: return NSLocalizedString("Your username has been successfully created", comment: "Usernames") case .failed: @@ -141,12 +79,12 @@ struct JoinDashPayView: View { } } - private var subtitleText: String { - switch viewModel.state { + var subtitle: String { + switch state { case .none: return NSLocalizedString("Request your username", comment: "") case .callToAction: - switch shieldedReadiness.standardSnapshot?.state { + switch shieldedSnapshot?.state { case .maturing(let readyAt): let time = DateFormatter.localizedString(from: readyAt, dateStyle: .none, timeStyle: .short) return String.localizedStringWithFormat( @@ -164,29 +102,29 @@ struct JoinDashPayView: View { NSLocalizedString( "Username %@ has been submitted for voting. Voting ends around %@.", comment: "Usernames"), - viewModel.username, + username, endDate) } return String.localizedStringWithFormat( NSLocalizedString( "Username %@ has been submitted for voting. We will notify you when voting ends.", comment: "Usernames"), - viewModel.username) + username) case .approved: return NSLocalizedString("Get started by setting up your profile picture and other information.", comment: "Usernames") case .failed: - return String.localizedStringWithFormat(NSLocalizedString("For some reason, the request for the username '%@' has failed.", comment: "Usernames"), viewModel.username) + return String.localizedStringWithFormat(NSLocalizedString("For some reason, the request for the username '%@' has failed.", comment: "Usernames"), username) case .blocked: - return String.localizedStringWithFormat(NSLocalizedString("The username '%@' was blocked by the Dash Network. Please try again by requesting another username.", comment: "Usernames"), viewModel.username) + return String.localizedStringWithFormat(NSLocalizedString("The username '%@' was blocked by the Dash Network. Please try again by requesting another username.", comment: "Usernames"), username) case .contested: - return String.localizedStringWithFormat(NSLocalizedString("Due to the voting process, the Dash Network has decided to assign the username '%@' to someone else. Please try again by requesting another username.", comment: "Usernames"), viewModel.username) + return String.localizedStringWithFormat(NSLocalizedString("Due to the voting process, the Dash Network has decided to assign the username '%@' to someone else. Please try again by requesting another username.", comment: "Usernames"), username) case .registered: return "" } } - private var actionButtonText: String { - switch viewModel.state { + var actionText: String { + switch state { case .callToAction: return NSLocalizedString("Upgrade", comment: "") case .approved: @@ -195,9 +133,9 @@ struct JoinDashPayView: View { return NSLocalizedString("Retry", comment: "") } } - - private var actionButtonIcon: IconName? { - switch viewModel.state { + + var actionIcon: IconName? { + switch state { case .failed, .blocked, .contested: return .system("arrow.counterclockwise") default: @@ -205,3 +143,171 @@ struct JoinDashPayView: View { } } } + +/// The Join DashPay banner, rendered as a standard menu row. Used on both +/// Home and More. +/// +/// There are no Hide/Upgrade buttons: the whole row is the primary action — +/// tapping it means "act on this state" (upgrade / edit profile / retry). +/// +/// `onDismiss` is optional and decides whether the trailing close control +/// exists. Home passes it (the banner is an interruption there, so it must +/// be dismissible); More does not, because the banner is a permanent menu +/// entry that the user scrolls past rather than something to get rid of. +struct JoinDashPayMenuItem: View { + @StateObject var viewModel: JoinDashPayViewModel + @ObservedObject private var shieldedReadiness = ShieldedIdentityFundingReadiness.shared + var onTap: (JoinDashPayState) -> Void + var onDismiss: ((JoinDashPayState) -> Void)? = nil + /// Chain still catching up. The row stays visible but presents itself as + /// unavailable — greyed icon and text, a note saying why, and no action — + /// because registration cannot start before the chain is synced. Showing + /// it and refusing the tap is what tells the user the feature exists and + /// is coming; hiding the row entirely (the previous behaviour) just made + /// it look like the menu was missing an entry. + var isSyncing: Bool = false + + private var copy: JoinDashPayCopy { + JoinDashPayCopy( + state: viewModel.state, + username: viewModel.username, + shieldedSnapshot: shieldedReadiness.standardSnapshot) + } + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + DashUIKit.MenuItem( + leadingIcon: .custom(copy.iconName, bundle: .main), + isEnabled: !isSyncing, + disabledLeadingIcon: .custom("menu-send-account-disabled", bundle: .dashUIKit), + title: copy.title, + helpText: viewModel.state == .registered ? nil : copy.subtitle, + accessory: .none + ) + // No action while the chain is catching up: every destination this + // row leads to (join, retry, edit profile) needs a synced chain, so + // a tap here could only fail. The note below says why. + .onTapGesture { + guard !isSyncing else { return } + onTap(viewModel.state) + } + .overlay(alignment: .topTrailing) { + if let onDismiss { + Button { + onDismiss(viewModel.state) + } label: { + XmarkIcon(size: 10, color: .dash.tertiaryText) + // Keep the tap target comfortable without letting + // the glyph itself push the row's layout around. + .padding(14) + .contentShape(Rectangle()) + } + // An overlay rather than `MenuItem`'s `accessory:` — the + // accessory sits vertically centred in the row, and this + // close belongs in the top trailing corner. + .buttonStyle(.plain) + } + } + + if isSyncing { + HStack(spacing: 0) { + Spacer() + + Text(NSLocalizedString("Available after sync finishes", comment: "DashPay")) + .dashFont(.footnote) + .foregroundStyle(Color.dash.blue) + .padding(.horizontal, 16) + .padding(.vertical, 6) + .background(Color.dash.blueAlpha5) + .clipShape(.rect(cornerRadius: 14)) + + Spacer() + } + .padding(.bottom, 8) + } + } + .modifier(MenuViewModifier()) + .onAppear { + viewModel.checkUsername() + } + } +} + +// MARK: - Previews + +/// The syncing presentation: greyed icon and text via `MenuItem`'s own +/// disabled styling, the "available after sync" note, and no action. Compare +/// against the enabled previews below — the row must stay in place and only +/// change its appearance, never disappear. +#Preview("Menu row — syncing") { + VStack(spacing: 12) { + JoinDashPayMenuItem( + viewModel: JoinDashPayViewModel(initialState: .callToAction), + onTap: { _ in }, + isSyncing: true) + + JoinDashPayMenuItem( + viewModel: JoinDashPayViewModel(initialState: .callToAction), + onTap: { _ in }, + isSyncing: false) + } + .padding(20) +} + +/// The More presentation: no close control — the row is a permanent menu +/// entry there. Rendered inside the same card the menu groups use. +#Preview("Menu row — More (no close)") { + ScrollView { + VStack(spacing: 12) { + ForEach( + [ + JoinDashPayState.callToAction, + .voting, + .approved, + .failed, + .blocked, + .contested, + .registered + ], + id: \.self + ) { state in + JoinDashPayMenuItem( + viewModel: JoinDashPayViewModel(initialState: state), + onTap: { _ in }) + .padding(6) + .background(Color.dash.secondaryBackground) + .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous)) + } + } + .padding(20) + } +} + +/// The Home presentation: identical row plus the trailing close control. +/// Worth comparing against the More preview — the close sits in the top +/// trailing corner and must not shift the title or subtitle. +#Preview("Menu row — Home (with close)") { + ScrollView { + VStack(spacing: 12) { + ForEach( + [ + JoinDashPayState.callToAction, + .voting, + .approved, + .failed, + .registered + ], + id: \.self + ) { state in + JoinDashPayMenuItem( + viewModel: JoinDashPayViewModel(initialState: state), + onTap: { _ in }, + onDismiss: { _ in }) + .padding(6) + .background(Color.dash.secondaryBackground) + .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous)) + } + } + .padding(20) + } +} diff --git a/DashWallet/Sources/UI/Home/Views/HomeView.swift b/DashWallet/Sources/UI/Home/Views/HomeView.swift index d895e369a2..ed35bec3d5 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeView.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeView.swift @@ -319,12 +319,19 @@ struct HomeViewContent: View { .frame(height: viewModel.headerHeight) } + SyncingHeaderView(onFilterTap: { + showFilterDialog = true + }, onSyncTap: { + delegate?.homeViewShowSyncingStatus() + }) + #if DASHPAY if viewModel.showJoinDashpay { - JoinDashPayView( + JoinDashPayMenuItem( viewModel: joinDPViewModel, - onTap: { _ in }, - onActionButton: { state in + // The row is the action now — this is what the + // Upgrade/Edit/Retry button used to do. + onTap: { state in if state == .approved { delegate?.homeViewEditProfile() joinDPViewModel.markAsDismissed() @@ -340,21 +347,15 @@ struct HomeViewContent: View { // they first looked at DashPay. self.shouldShowJoinDashPayInfo = true } - }, onDismissButton: { _ in + }, onDismiss: { _ in joinDPViewModel.markAsDismissed() viewModel.checkJoinDashPay() } - ).padding(.horizontal, 14) - .padding(.bottom, 4) + ) + .padding(.horizontal, 20) } #endif - - SyncingHeaderView(onFilterTap: { - showFilterDialog = true - }, onSyncTap: { - delegate?.homeViewShowSyncingStatus() - }) - + if viewModel.txItems.isEmpty { // An empty feed means "nothing yet" only once the first // load has finished; before that it just means the diff --git a/DashWallet/Sources/UI/Main/MainTabbarController.swift b/DashWallet/Sources/UI/Main/MainTabbarController.swift index 0b0c39fcb6..2e769b7088 100644 --- a/DashWallet/Sources/UI/Main/MainTabbarController.swift +++ b/DashWallet/Sources/UI/Main/MainTabbarController.swift @@ -333,12 +333,20 @@ extension MainTabbarController { } func applyPendingDashPayTabReconfiguration() { - guard pendingDashPayTabReconfiguration else { return } - if containsCreateUsernameController(in: self) { return } + // Deliberately NOT gated on `pendingDashPayTabReconfiguration`. That + // flag is only raised once `reconfigureDashPayTabsIfNeeded` has already + // seen an identity, but the canonical registration notification can be + // posted before `DWCurrentUserIdentityInfo` observes the new + // `PersistentIdentity` row — the `hasDashPayIdentity` guard then + // returns first and the flag is never set. Gating here on a flag that + // was never raised is what left the DashPay tabs missing until the + // next launch. `reconfigureDashPayTabsIfNeeded` is idempotent (it + // early-returns once the five-tab layout is installed), so calling it + // unconditionally is safe. reconfigureDashPayTabsIfNeeded() } #endif diff --git a/DashWallet/Sources/UI/Menu/Main/MainMenuViewController.swift b/DashWallet/Sources/UI/Menu/Main/MainMenuViewController.swift index 8385f6cdbb..7e1df18eaf 100644 --- a/DashWallet/Sources/UI/Menu/Main/MainMenuViewController.swift +++ b/DashWallet/Sources/UI/Menu/Main/MainMenuViewController.swift @@ -215,28 +215,20 @@ struct MainMenuScreen: View { var body: some View { ScrollView { LazyVStack(alignment: .leading, spacing: 0) { - TopIntro(title: NSLocalizedString("More", comment: "")) - .padding(.leading, 20) - .padding(.trailing, 60) - .padding(.top, 10) - .padding(.bottom, 20) - #if DASHPAY if viewModel.showJoinDashpay { - JoinDashPayView( + JoinDashPayMenuItem( viewModel: joinDPViewModel, + // The row replaced a card with two buttons, so it + // needs a handler covering both — see + // `handleJoinDashPayRowTap`. onTap: { state in - handleJoinDashPayTap(state: state) - }, - onActionButton: { state in - handleJoinDashPayAction(state: state) + handleJoinDashPayRowTap(state: state) }, - onDismissButton: { state in - joinDPViewModel.markAsDismissed() - viewModel.refreshJoinDashPayBanner() - } + isSyncing: viewModel.isSyncing ) - .padding(.horizontal, 18) + .padding(.vertical, 20) + .padding(.horizontal, 20) } #endif @@ -432,6 +424,26 @@ struct MainMenuScreen: View { vc.pushViewController(controller, animated: true) } + /// Where a tap on the DashPay menu row goes. The row replaced a card with + /// two buttons, so it has to cover what both of them did — it is not the + /// old action button under a new name. + /// + /// In particular `.callToAction` must NOT reach `editProfile()`: that + /// method guards on an existing identity and returns silently for exactly + /// the users this state describes, which read on screen as a dead row. + private func handleJoinDashPayRowTap(state: JoinDashPayState) { + switch state { + case .none, .callToAction, .blocked, .failed, .contested: + // Not registered (or the attempt failed): open the join flow, + // which also carries the "Have an invitation?" entry. + handleJoinButtonAction() + case .approved, .registered: + editProfile() + case .voting: + showUsernameRequestStatus() + } + } + private func handleJoinDashPayAction(state: JoinDashPayState) { switch state { case .blocked, .failed, .contested: diff --git a/DashWallet/Sources/UI/Menu/Main/MainMenuViewModel.swift b/DashWallet/Sources/UI/Menu/Main/MainMenuViewModel.swift index 51eef71288..50d937483f 100644 --- a/DashWallet/Sources/UI/Menu/Main/MainMenuViewModel.swift +++ b/DashWallet/Sources/UI/Menu/Main/MainMenuViewModel.swift @@ -50,6 +50,7 @@ class MainMenuViewModel: ObservableObject { let dashPayModel: DWDashPayProtocol? let userProfileModel: CurrentUserProfileModel? @Published private(set) var showJoinDashpay: Bool = false + @Published private(set) var isSyncing: Bool = false #endif weak var delegate: MainMenuViewModelDelegate? @@ -66,6 +67,10 @@ class MainMenuViewModel: ObservableObject { userProfileModel?.$showJoinDashpay .receive(on: DispatchQueue.main) .assign(to: &$showJoinDashpay) + + userProfileModel?.$isSyncing + .receive(on: DispatchQueue.main) + .assign(to: &$isSyncing) } func refreshJoinDashPayBanner() { diff --git a/DashWallet/en.lproj/Localizable.strings b/DashWallet/en.lproj/Localizable.strings index 8aee12cd39..0f2f6fd9f2 100644 --- a/DashWallet/en.lproj/Localizable.strings +++ b/DashWallet/en.lproj/Localizable.strings @@ -452,6 +452,9 @@ /* No comment provided by engineer. */ "Autohide Balance" = "Autohide Balance"; +/* DashPay */ +"Available after sync finishes" = "Available after sync finishes"; + /* SPV diagnostics */ "Available only while SPV is running with a wallet bound." = "Available only while SPV is running with a wallet bound."; From b25943442d43efa085733856a0651abbc1e3c114 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:32:18 +0300 Subject: [PATCH 2/4] chore(deps): bump DashUIKit to the revision carrying menu-send-account-disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `JoinDashPayMenuItem` passes `menu-send-account-disabled` as the row's `disabledLeadingIcon`. The asset landed in DashUIKit#12; without this bump a fresh checkout resolves to a master revision that predates it and the disabled icon renders as nothing. The pin is a branch (`master`), so this only fixes the recorded revision — Xcode also rewrote the file's key spacing, which accounts for the rest of the diff. --- .../xcshareddata/swiftpm/Package.resolved | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DashWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DashWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3780d03743..f215913128 100644 --- a/DashWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DashWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,15 +1,15 @@ { - "originHash": "cecc72572cc422aa0d68b46e2be53c36997e822a15e2da6434836b8dda9e4934", - "pins": [ + "originHash" : "2b9d5280ec4645105debdfd588a911137d45333db7102b1ec79310afb20db9cc", + "pins" : [ { - "identity": "dashuikit", - "kind": "remoteSourceControl", - "location": "https://github.com/dashpay/DashUIKit", - "state": { - "branch": "master", - "revision": "88bf41f3c3e8c66bf7ac653841643d4a4bed2444" + "identity" : "dashuikit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/dashpay/DashUIKit", + "state" : { + "branch" : "master", + "revision" : "5b373b141054438e94903af52b9ec324f1efbdb2" } } ], - "version": 3 + "version" : 3 } From 6274177ab63237d3b3549af0a96c60515c85401c Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:37:38 +0300 Subject: [PATCH 3/4] fix(dashpay): keep the Home banner up during sync instead of hiding it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Home banner was gated on `syncDone`, so it did not exist for the whole of a long sync. That hid the only surface in the app carrying the "Have an invitation?" entry from exactly the user who needs it — someone who was just invited and is opening the wallet for the first time, which is also when the chain is furthest behind. It now behaves like the More entry: the row stays put and renders as unavailable (greyed leading icon and text, "Available after sync finishes", inert tap) while the chain catches up. `HomeViewModel` publishes `isSyncing` from the `syncModel.$state` subscription it already had. The close control stays live throughout — dismissing an interruption should not depend on the chain, even while the action behind it is unavailable. --- DashWallet/Sources/UI/Home/Views/HomeView.swift | 3 ++- .../Sources/UI/Home/Views/HomeViewModel.swift | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/DashWallet/Sources/UI/Home/Views/HomeView.swift b/DashWallet/Sources/UI/Home/Views/HomeView.swift index ed35bec3d5..25f9287897 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeView.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeView.swift @@ -350,7 +350,8 @@ struct HomeViewContent: View { }, onDismiss: { _ in joinDPViewModel.markAsDismissed() viewModel.checkJoinDashPay() - } + }, + isSyncing: viewModel.isSyncing ) .padding(.horizontal, 20) } diff --git a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift index 7661598be5..ad7f5dbe03 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift @@ -167,6 +167,10 @@ class HomeViewModel: ObservableObject { @Published var showCoinJoinMoveFundsSheet: Bool = false @Published private(set) var timeSkew: TimeInterval = 0 @Published private(set) var showJoinDashpay: Bool = false + /// Chain still catching up. The Join DashPay banner stays visible + /// throughout but presents itself as unavailable: registration cannot be + /// started until the chain is synced. + @Published private(set) var isSyncing: Bool = false /// Selected filter categories (multi-select checkboxes). Defaults to every /// category — i.e. "All". Never empty: the dialog blocks unchecking the /// last box. @@ -440,6 +444,9 @@ class HomeViewModel: ObservableObject { .receive(on: DispatchQueue.main) .sink { [weak self] state in guard let self = self else { return } + #if DASHPAY + self.isSyncing = state != .syncDone + #endif if state == .syncing { // Reload once per transition into .syncing — replaces the // legacy sync-will-start notification observer. Goes @@ -2930,7 +2937,12 @@ extension HomeViewModel { self.showJoinDashpay = JoinDashPayBannerPolicy.shouldShow( contextReady: identityState.contextReady, - syncDone: syncModel.state == .syncDone, + // Not gated on sync — same as the More entry. Gating made the + // banner appear only once the chain had caught up, so the surface + // that carries the "Have an invitation?" entry was missing for the + // whole of a long sync. It now stays put and renders as + // unavailable (`isSyncing`) instead of vanishing. + syncDone: true, dismissed: UsernamePrefs.shared.joinDashPayDismissed, hasRegisteredUsername: hasRegisteredUsername, hasRegistrationInProgress: identityScopedRegistrationState) From fa1f033a67a596d17dcf1c5b5a0f71a5c74c8d03 Mon Sep 17 00:00:00 2001 From: Roman <51091564+jeanpierreroma@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:41:39 +0300 Subject: [PATCH 4/4] style(dashpay): drop the redundant nil initializer on onDismiss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SwiftLint's `implicit_optional_initialization` — an optional var is already nil. No behaviour change: the memberwise initializer still defaults the parameter, so `JoinDashPayMenuItem` can be built without an `onDismiss`. --- .../UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift index 13fe1560fb..438db47440 100644 --- a/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift +++ b/DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayView.swift @@ -158,7 +158,7 @@ struct JoinDashPayMenuItem: View { @StateObject var viewModel: JoinDashPayViewModel @ObservedObject private var shieldedReadiness = ShieldedIdentityFundingReadiness.shared var onTap: (JoinDashPayState) -> Void - var onDismiss: ((JoinDashPayState) -> Void)? = nil + var onDismiss: ((JoinDashPayState) -> Void)? /// Chain still catching up. The row stays visible but presents itself as /// unavailable — greyed icon and text, a note saying why, and no action — /// because registration cannot start before the chain is synced. Showing