Hide the receive rotation notice for static Zcash address types (#3444)

This commit is contained in:
Seth For Privacy
2026-08-07 02:20:32 +02:00
committed by GitHub
parent 14d2862b39
commit fb790120ed
4 changed files with 28 additions and 1 deletions
+12
View File
@@ -97,6 +97,10 @@ class _NewReceivePageState extends State<NewReceivePage> {
) 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<NewReceivePage> {
autoGenerateSubaddressStatus: widget.lightningMode
? AutoGenerateSubaddressStatus.disabled
: widget.dashboardViewModel.settingsStore.autoGenerateSubaddressStatus,
addressRotates: _selectedAddressRotates,
);
return Container(
@@ -366,6 +371,13 @@ class _NewReceivePageState extends State<NewReceivePage> {
);
}
/// 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,
@@ -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<CryptoCurrency>? supportedCurrencies}) {
List<CryptoCurrency>? 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,
+8
View File
@@ -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();
+1
View File
@@ -1766,6 +1766,7 @@ abstract class Zcash {
ReceivePageOption getSelectedAddressType(Object wallet);
dynamic getZcashAddressType(ReceivePageOption option);
bool hasSelectedTransparentAddress(Object wallet);
bool isRotatingAddressOption(ReceivePageOption option);
Future<void> setAddressType(Object wallet, dynamic option);
dynamic getOptionToType(ReceivePageOption option);
void unlockDatabase(String password);