diff --git a/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart b/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart index 530950ec4..2a24fd4c8 100644 --- a/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart +++ b/lib/pages/paynym/dialogs/claiming_paynym_dialog.dart @@ -5,6 +5,7 @@ import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackwallet/widgets/desktop/secondary_button.dart'; import 'package:stackwallet/widgets/stack_dialog.dart'; @@ -49,38 +50,61 @@ class _RestoringDialogState extends State Widget build(BuildContext context) { if (Util.isDesktop) { return DesktopDialog( - child: Padding( - padding: const EdgeInsets.all(40), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Claiming PayNym", - style: STextStyles.desktopH3(context), - ), - const SizedBox( - height: 20, - ), - Text( - "We are generating your PayNym", - style: STextStyles.desktopSubtitleH1(context), - ), - const SizedBox( + maxWidth: 580, + maxHeight: double.infinity, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + DesktopDialogCloseButton( + onPressedOverride: () => Navigator.of(context).pop(true), + ), + ], + ), + RotationTransition( + turns: _spinAnimation, + child: SvgPicture.asset( + Assets.svg.arrowRotate, + color: + Theme.of(context).extension()!.accentColorDark, + width: 40, height: 40, ), - RotationTransition( - turns: _spinAnimation, - child: SvgPicture.asset( - Assets.svg.arrowRotate, - color: Theme.of(context) - .extension()! - .accentColorDark, - width: 24, - height: 24, - ), + ), + Padding( + padding: const EdgeInsets.all(40), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Claiming PayNym", + style: STextStyles.desktopH2(context), + ), + const SizedBox( + height: 20, + ), + Text( + "We are generating your PayNym", + style: STextStyles.desktopTextMedium(context).copyWith( + color: + Theme.of(context).extension()!.textDark3, + ), + ), + const SizedBox( + height: 40, + ), + SecondaryButton( + label: "Cancel", + width: 272, + onPressed: () { + Navigator.of(context).pop(true); + }, + ), + ], ), - ], - ), + ), + ], ), ); } else { diff --git a/lib/pages/paynym/paynym_claim_view.dart b/lib/pages/paynym/paynym_claim_view.dart index 1f60ecda4..cf5ffc671 100644 --- a/lib/pages/paynym/paynym_claim_view.dart +++ b/lib/pages/paynym/paynym_claim_view.dart @@ -165,15 +165,20 @@ class _PaynymClaimViewState extends ConsumerState { .getManager(widget.walletId) .wallet as DogecoinWallet; + if (shouldCancel) return; + // get payment code final pCode = await wallet.getPaymentCode(); + if (shouldCancel) return; + // attempt to create new entry in paynym.is db final created = await ref .read(paynymAPIProvider) .create(pCode.toString()); debugPrint("created:$created"); + if (shouldCancel) return; if (created.value!.claimed) { // payment code already claimed @@ -193,18 +198,26 @@ class _PaynymClaimViewState extends ConsumerState { return; } + if (shouldCancel) return; + final token = await ref.read(paynymAPIProvider).token(pCode.toString()); + if (shouldCancel) return; + // sign token with notification private key final signature = await wallet.signStringWithNotificationKey(token.value!); + if (shouldCancel) return; + // claim paynym account final claim = await ref .read(paynymAPIProvider) .claim(token.value!, signature); + if (shouldCancel) return; + if (claim.value?.claimed == pCode.toString()) { final account = await ref.read(paynymAPIProvider).nym(pCode.toString());