From fb790120ed39455ffa915e66a0388107888e201f Mon Sep 17 00:00:00 2001 From: Seth For Privacy <40500387+sethforprivacy@users.noreply.github.com> Date: Thu, 6 Aug 2026 20:20:32 -0400 Subject: [PATCH] Hide the receive rotation notice for static Zcash address types (#3444) --- lib/new-ui/pages/receive_page.dart | 12 ++++++++++++ .../widgets/receive_page/receive_info_box.dart | 8 +++++++- lib/zcash/cw_zcash.dart | 8 ++++++++ tool/configure.dart | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/new-ui/pages/receive_page.dart b/lib/new-ui/pages/receive_page.dart index b5656e9de..2948f9a93 100644 --- a/lib/new-ui/pages/receive_page.dart +++ b/lib/new-ui/pages/receive_page.dart @@ -97,6 +97,10 @@ class _NewReceivePageState extends State { ) as WalletAddressListItem?; reaction((_) => widget.receiveOptionViewModel.selectedReceiveOption, (option) { + // The infobox depends on the selected address type, so the page has to be + // rebuilt when it changes. + if (mounted) setState(() {}); + if (widget.dashboardViewModel.type == WalletType.bitcoin && bitcoin!.isBitcoinReceivePageOption(option)) { widget.addressListViewModel.setAddressType(bitcoin!.getOptionToType(option)); @@ -179,6 +183,7 @@ class _NewReceivePageState extends State { autoGenerateSubaddressStatus: widget.lightningMode ? AutoGenerateSubaddressStatus.disabled : widget.dashboardViewModel.settingsStore.autoGenerateSubaddressStatus, + addressRotates: _selectedAddressRotates, ); return Container( @@ -366,6 +371,13 @@ class _NewReceivePageState extends State { ); } + /// Zcash is the only wallet type that also offers static address types, so + /// the rotation notice must not be shown for it unless the disposable + /// transparent type is the one currently selected. + bool get _selectedAddressRotates => + widget.addressListViewModel.type != WalletType.zcash || + zcash!.isRotatingAddressOption(widget.receiveOptionViewModel.selectedReceiveOption); + void _showLabelModal() { showMaterialModalBottomSheet( context: context, diff --git a/lib/new-ui/widgets/receive_page/receive_info_box.dart b/lib/new-ui/widgets/receive_page/receive_info_box.dart index db34cef16..ac3f1acfd 100644 --- a/lib/new-ui/widgets/receive_page/receive_info_box.dart +++ b/lib/new-ui/widgets/receive_page/receive_info_box.dart @@ -16,10 +16,15 @@ class ReceiveInfoBox extends StatelessWidget { required this.onDismissed, this.bottomWidget}); + /// [addressRotates] tells whether the address type currently selected on the + /// receive page actually rotates. Most wallet types only ever expose rotating + /// address types, so it defaults to true; Zcash also offers static types, for + /// which the rotation notice would be wrong. static ReceiveInfoBox? forWalletType(WalletType type, {required VoidCallback onDismissed, required AutoGenerateSubaddressStatus autoGenerateSubaddressStatus, - List? supportedCurrencies}) { + List? supportedCurrencies, + bool addressRotates = true}) { switch (type) { case WalletType.nano: return null; @@ -43,6 +48,7 @@ class ReceiveInfoBox extends StatelessWidget { )); default: if (autoGenerateSubaddressStatus == AutoGenerateSubaddressStatus.disabled) return null; + if (!addressRotates) return null; return ReceiveInfoBox( iconPath: "assets/new-ui/info.svg", message: S.current.infobox_auto_address, diff --git a/lib/zcash/cw_zcash.dart b/lib/zcash/cw_zcash.dart index 51c9dc53e..8abef07dc 100644 --- a/lib/zcash/cw_zcash.dart +++ b/lib/zcash/cw_zcash.dart @@ -176,6 +176,14 @@ class CWZcash extends Zcash { return getSelectedAddressType(wallet) == ZcashReceivePageOption.transparentRotated; } + /// The disposable transparent type is the only Zcash address type that + /// rotates. The public transparent address, both shielded types and the + /// unified address are all derived from the account and stay the same. + @override + bool isRotatingAddressOption(ReceivePageOption option) { + return option == ZcashReceivePageOption.transparentRotated; + } + @override dynamic getZcashAddressType(ReceivePageOption option) { return (option as ZcashReceivePageOption).toType(); diff --git a/tool/configure.dart b/tool/configure.dart index c0ce610a4..19e1521fd 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -1766,6 +1766,7 @@ abstract class Zcash { ReceivePageOption getSelectedAddressType(Object wallet); dynamic getZcashAddressType(ReceivePageOption option); bool hasSelectedTransparentAddress(Object wallet); + bool isRotatingAddressOption(ReceivePageOption option); Future setAddressType(Object wallet, dynamic option); dynamic getOptionToType(ReceivePageOption option); void unlockDatabase(String password);