Problem
When a user has a Spark wallet lightning address set up (e.g. username@wisp.dev) but their published kind-0 metadata lud16 field is empty or points elsewhere, zaps land in the wrong wallet (or fail). The Android Profile Edit screen currently shows no hint about this mismatch.
iOS already handles this: it shows a one-tap "Use" button under the Lightning Address field whenever walletStore.lightningAddress differs from viewModel.lud16.
Reference (iOS)
wisp-ios/ProfileEditView.swift (~lines 186–215):
field(label: "Lightning Address", text: $viewModel.lud16, …)
if let walletAddr = walletStore?.lightningAddress,
!walletAddr.isEmpty,
walletAddr.lowercased() != viewModel.lud16.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() {
HStack(spacing: 6) {
Image(systemName: "bolt.fill").foregroundStyle(Color.wispZapColor)
Text("Wallet: \(walletAddr)")
.font(.caption).foregroundStyle(.secondary)
Spacer()
Button {
viewModel.lud16 = walletAddr
} label: {
Text("Use")
.font(.caption.weight(.semibold))
.padding(.horizontal, 10).padding(.vertical, 4)
.background(Color.wispPrimary.opacity(0.15), in: Capsule())
.foregroundStyle(Color.wispPrimary)
}
}
}
Proposed Android implementation
Edit app/src/main/kotlin/com/wisp/app/ui/screen/ProfileEditScreen.kt around line 194 (the existing lud16 OutlinedTextField). Below the field, render a Row that's only visible when:
walletViewModel.lightningAddress.collectAsState().value is non-null and non-blank, AND
- it does not match the current
lud16 field (case-insensitive, trimmed)
The Row contains:
- Bolt icon (
Icons.Outlined.Bolt, tinted WispThemeColors.zapColor)
Text("Wallet: $walletAddr", style = bodySmall, color = onSurfaceVariant)
- Spacer
- Compact "Use" button that calls
viewModel.updateLud16(walletAddr) — styled as a small capsule with primary.copy(alpha = 0.15f) background, primary-colored text
Notes
- The Profile Edit ViewModel will need access to the wallet's lightning address — either inject a shared
WalletViewModel reference, or read directly from the lightning-address SharedPreferences/repo used by WalletViewModel.
- Make sure publishing the profile after tapping "Use" still works without an extra "save" step (consistent with iOS — "Use" only updates the local field; user still has to tap Save / Publish).
Related
- iOS implementation already shipped:
wisp-ios/ProfileEditView.swift
Problem
When a user has a Spark wallet lightning address set up (e.g.
username@wisp.dev) but their published kind-0 metadatalud16field is empty or points elsewhere, zaps land in the wrong wallet (or fail). The Android Profile Edit screen currently shows no hint about this mismatch.iOS already handles this: it shows a one-tap "Use" button under the Lightning Address field whenever
walletStore.lightningAddressdiffers fromviewModel.lud16.Reference (iOS)
wisp-ios/ProfileEditView.swift(~lines 186–215):Proposed Android implementation
Edit
app/src/main/kotlin/com/wisp/app/ui/screen/ProfileEditScreen.ktaround line 194 (the existinglud16OutlinedTextField). Below the field, render a Row that's only visible when:walletViewModel.lightningAddress.collectAsState().valueis non-null and non-blank, ANDlud16field (case-insensitive, trimmed)The Row contains:
Icons.Outlined.Bolt, tintedWispThemeColors.zapColor)Text("Wallet: $walletAddr", style = bodySmall, color = onSurfaceVariant)viewModel.updateLud16(walletAddr)— styled as a small capsule withprimary.copy(alpha = 0.15f)background, primary-colored textNotes
WalletViewModelreference, or read directly from the lightning-address SharedPreferences/repo used byWalletViewModel.Related
wisp-ios/ProfileEditView.swift