Skip to content

Commit b367aa9

Browse files
committed
Masternode collateral dialogs on mobile
1 parent 1d877fd commit b367aa9

1 file changed

Lines changed: 75 additions & 131 deletions

File tree

lib/pages/masternodes/masternodes_home_view.dart

Lines changed: 75 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -310,102 +310,52 @@ class _MasternodesHomeViewState extends ConsumerState<MasternodesHomeView> {
310310
fractionDigits: wallet.cryptoCurrency.fractionDigits,
311311
).decimal;
312312

313-
if (Util.isDesktop) {
314-
final shouldOpenSend = await showDialog<bool>(
315-
context: context,
316-
builder: (ctx) => StackDialog(
317-
title: "Unshield FIRO for masternode collateral?",
318-
message:
319-
"Masternode collateral must be a single 1000 FIRO UTXO "
320-
"in your transparent balance. You will need to unshield "
321-
"part of your Spark private balance into your transparent "
322-
"balance to create this collateral along with the "
323-
"transaction fee required to register it.\n\n"
324-
"Do you want to unshield $deficitDecimal FIRO from your "
325-
"private Spark balance to your transparent balance? Once "
326-
"this transaction is confirmed, click \"Create Masternode\" "
327-
"again to continue to the next step.\n\n"
328-
"Note: there may be an additional step to consolidate your "
329-
"transparent balance into a single UTXO before allowing "
330-
"you to register your masternode.",
331-
leftButton: TextButton(
332-
style: Theme.of(ctx)
333-
.extension<StackColors>()!
334-
.getSecondaryEnabledButtonStyle(ctx),
335-
onPressed: () => Navigator.of(ctx).pop(),
336-
child: Text(
337-
"Cancel",
338-
style: STextStyles.button(ctx).copyWith(
339-
color: Theme.of(
340-
ctx,
341-
).extension<StackColors>()!.accentColorDark,
342-
),
313+
final shouldOpenSend = await showDialog<bool>(
314+
context: context,
315+
builder: (ctx) => StackDialog(
316+
title: "Unshield FIRO for masternode collateral?",
317+
message:
318+
"Masternode collateral must be a single 1000 FIRO UTXO "
319+
"in your transparent balance. You will need to unshield "
320+
"part of your Spark private balance into your transparent "
321+
"balance to create this collateral along with the "
322+
"transaction fee required to register it.\n\n"
323+
"Do you want to unshield $deficitDecimal FIRO from your "
324+
"private Spark balance to your transparent balance? Once "
325+
"this transaction is confirmed, click \"Create Masternode\" "
326+
"again to continue to the next step.\n\n"
327+
"Note: there may be an additional step to consolidate your "
328+
"transparent balance into a single UTXO before allowing "
329+
"you to register your masternode.",
330+
leftButton: TextButton(
331+
style: Theme.of(
332+
ctx,
333+
).extension<StackColors>()!.getSecondaryEnabledButtonStyle(ctx),
334+
onPressed: () => Navigator.of(ctx).pop(),
335+
child: Text(
336+
"Cancel",
337+
style: STextStyles.button(ctx).copyWith(
338+
color: Theme.of(
339+
ctx,
340+
).extension<StackColors>()!.accentColorDark,
343341
),
344342
),
345-
rightButton: TextButton(
346-
style: Theme.of(
347-
ctx,
348-
).extension<StackColors>()!.getPrimaryEnabledButtonStyle(ctx),
349-
onPressed: () => Navigator.of(ctx).pop(true),
350-
child: Text("Open Send", style: STextStyles.button(ctx)),
351-
),
352343
),
353-
);
354-
if (shouldOpenSend == true && mounted) {
355-
await _openCreateCollateralSendFlow(
356-
wallet,
357-
fromPrivate: true,
358-
unshieldAmount: deficitDecimal,
359-
);
360-
}
361-
} else {
362-
final shouldOpenSend = await showDialog<bool>(
363-
context: context,
364-
builder: (ctx) => StackDialog(
365-
title: "Unshield FIRO for masternode collateral?",
366-
message:
367-
"Masternode collateral must be a single 1000 FIRO UTXO "
368-
"in your transparent balance. You will need to unshield "
369-
"part of your Spark private balance into your transparent "
370-
"balance to create this collateral along with the "
371-
"transaction fee required to register it.\n\n"
372-
"Do you want to unshield $deficitDecimal FIRO from your "
373-
"private Spark balance to your transparent balance? Once "
374-
"this transaction is confirmed, click \"Create Masternode\" "
375-
"again to continue to the next step.\n\n"
376-
"Note: there may be an additional step to consolidate your "
377-
"transparent balance into a single UTXO before allowing "
378-
"you to register your masternode.",
379-
leftButton: TextButton(
380-
style: Theme.of(ctx)
381-
.extension<StackColors>()!
382-
.getSecondaryEnabledButtonStyle(ctx),
383-
onPressed: () => Navigator.of(ctx).pop(),
384-
child: Text(
385-
"Cancel",
386-
style: STextStyles.button(ctx).copyWith(
387-
color: Theme.of(
388-
ctx,
389-
).extension<StackColors>()!.accentColorDark,
390-
),
391-
),
392-
),
393-
rightButton: TextButton(
394-
style: Theme.of(
395-
ctx,
396-
).extension<StackColors>()!.getPrimaryEnabledButtonStyle(ctx),
397-
onPressed: () => Navigator.of(ctx).pop(true),
398-
child: Text("Open Send", style: STextStyles.button(ctx)),
399-
),
344+
rightButton: TextButton(
345+
style: Theme.of(
346+
ctx,
347+
).extension<StackColors>()!.getPrimaryEnabledButtonStyle(ctx),
348+
onPressed: () => Navigator.of(ctx).pop(true),
349+
child: Text("Open Send", style: STextStyles.button(ctx)),
400350
),
351+
),
352+
);
353+
if (shouldOpenSend == true && mounted) {
354+
await _openCreateCollateralSendFlow(
355+
wallet,
356+
fromPrivate: true,
357+
unshieldAmount: deficitDecimal,
401358
);
402-
if (shouldOpenSend == true && mounted) {
403-
await _openCreateCollateralSendFlow(
404-
wallet,
405-
fromPrivate: true,
406-
unshieldAmount: deficitDecimal,
407-
);
408-
}
409359
}
410360
} else {
411361
await showDialog<void>(
@@ -426,49 +376,43 @@ class _MasternodesHomeViewState extends ConsumerState<MasternodesHomeView> {
426376
return;
427377
}
428378

429-
if (Util.isDesktop) {
430-
final shouldOpenSend = await showDialog<bool>(
431-
context: context,
432-
builder: (ctx) => StackDialog(
433-
title: "Set up your 1000 FIRO masternode collateral?",
434-
message:
435-
"Registering a masternode requires a 1000 FIRO collateral: "
436-
"a single confirmed amount sitting in your wallet. We didn't "
437-
"find one, but you have enough FIRO to create it.\n\n"
438-
"We can help by opening the Send window with a new address "
439-
"you own pre-filled, ready for you to send 1000 FIRO to it. "
440-
"This consolidates your smaller amounts into the single 1000 "
441-
"FIRO collateral you need. The network fee is paid from your "
442-
"remaining balance.\n\n"
443-
"Once you have sent it, wait for the transaction to confirm, "
444-
"then click Create Masternode again to continue.",
445-
leftButton: TextButton(
446-
style: Theme.of(
447-
ctx,
448-
).extension<StackColors>()!.getSecondaryEnabledButtonStyle(ctx),
449-
onPressed: () => Navigator.of(ctx).pop(),
450-
child: Text(
451-
"Cancel",
452-
style: STextStyles.button(ctx).copyWith(
453-
color: Theme.of(
454-
ctx,
455-
).extension<StackColors>()!.accentColorDark,
456-
),
379+
final shouldOpenSend = await showDialog<bool>(
380+
context: context,
381+
builder: (ctx) => StackDialog(
382+
title: "Set up your 1000 FIRO masternode collateral?",
383+
message:
384+
"Registering a masternode requires a 1000 FIRO collateral: "
385+
"a single confirmed amount sitting in your wallet. We didn't "
386+
"find one, but you have enough FIRO to create it.\n\n"
387+
"We can help by opening the Send window with a new address "
388+
"you own pre-filled, ready for you to send 1000 FIRO to it. "
389+
"This consolidates your smaller amounts into the single 1000 "
390+
"FIRO collateral you need. The network fee is paid from your "
391+
"remaining balance.\n\n"
392+
"Once you have sent it, wait for the transaction to confirm, "
393+
"then click Create Masternode again to continue.",
394+
leftButton: TextButton(
395+
style: Theme.of(
396+
ctx,
397+
).extension<StackColors>()!.getSecondaryEnabledButtonStyle(ctx),
398+
onPressed: () => Navigator.of(ctx).pop(),
399+
child: Text(
400+
"Cancel",
401+
style: STextStyles.button(ctx).copyWith(
402+
color: Theme.of(ctx).extension<StackColors>()!.accentColorDark,
457403
),
458404
),
459-
rightButton: TextButton(
460-
style: Theme.of(
461-
ctx,
462-
).extension<StackColors>()!.getPrimaryEnabledButtonStyle(ctx),
463-
onPressed: () => Navigator.of(ctx).pop(true),
464-
child: Text("Open Send", style: STextStyles.button(ctx)),
465-
),
466405
),
467-
);
468-
if (shouldOpenSend == true && mounted) {
469-
await _openCreateCollateralSendFlow(wallet);
470-
}
471-
} else {
406+
rightButton: TextButton(
407+
style: Theme.of(
408+
ctx,
409+
).extension<StackColors>()!.getPrimaryEnabledButtonStyle(ctx),
410+
onPressed: () => Navigator.of(ctx).pop(true),
411+
child: Text("Open Send", style: STextStyles.button(ctx)),
412+
),
413+
),
414+
);
415+
if (shouldOpenSend == true && mounted) {
472416
await _openCreateCollateralSendFlow(wallet);
473417
}
474418
return;

0 commit comments

Comments
 (0)