popup ui for wownero deprecation (#3186)

* fix: add "support for coin removed" to exception handler ignored list

* wownero deprecation popup

---------

Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
This commit is contained in:
malik1004x
2026-05-06 23:18:35 +02:00
committed by GitHub
co-authored by Czarek Nakamoto
parent 5feee62358
commit b5cec3576c
3 changed files with 93 additions and 5 deletions
+8 -3
View File
@@ -5,6 +5,7 @@ import 'package:cake_wallet/core/key_service.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/new-ui/widgets/wallet_deprecation_popup.dart';
import 'package:cake_wallet/reactions/on_authentication_state_change.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/exception_handler.dart';
@@ -15,6 +16,7 @@ import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_service.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_wownero/wownero_wallet_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -73,9 +75,12 @@ class WalletLoadingService {
return wallet;
} catch (error, stack) {
String corruptedWalletsSeeds = "Corrupted wallets seeds (if retrievable, empty otherwise):";
if ([WalletType.wownero, WalletType.haven].contains(type)) {
corruptedWalletsSeeds += "\n\n$type $name: $error";
if(error is WalletDeprecationException) {
if(navigatorKey.currentContext != null) {
showModalBottomSheet(
context: navigatorKey.currentContext!, builder: (context)=>WalletDeprecationPopup(type: type, seed: error.seed,));
}
} else {
await ExceptionHandler.resetLastPopupDate();
final isLedgerError = await ExceptionHandler.isLedgerError(error);
@@ -0,0 +1,72 @@
import 'package:cake_wallet/new-ui/widgets/animated_dropdown.dart';
import 'package:cake_wallet/new-ui/widgets/new_primary_button.dart';
import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart';
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cw_core/currency_for_wallet_type.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart';
class WalletDeprecationPopup extends StatelessWidget {
const WalletDeprecationPopup({super.key, required this.type, this.seed});
final WalletType type;
final String? seed;
@override
Widget build(BuildContext context) {
final curr = walletTypeToCryptoCurrency(type);
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
color: Theme.of(context).colorScheme.surface),
child: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ModalTopBar(
title: "",
leadingIcon: Icon(Icons.close),
onLeadingPressed: Navigator.of(context).pop,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
spacing: 24,
children: [
CakeImageWidget(
imageUrl: curr.iconSvgPath ?? curr.iconPath,
width: 64,
height: 64,
),
Text(
"${curr.fullName} is no longer supported",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
textAlign: TextAlign.center,
),
Text(
"Apologies for the inconvenience.",
textAlign: TextAlign.center,
),
if (seed != null) ...[
Text(
"If you need to migrate your seed, you can see it below.",
textAlign: TextAlign.center,
),
AnimatedDropdown(content: Text(seed!), dropdownText: "Tap to show seed"),
],
NewPrimaryButton(
onPressed: Navigator.of(context).pop,
text: "Close",
color: Theme.of(context).colorScheme.primary,
textColor: Theme.of(context).colorScheme.onPrimary),
SizedBox()
],
),
)
],
),
),
);
}
}