Skip to content

Commit

Permalink
fix: adjust conditions for displaying the rejection dialog when the s…
Browse files Browse the repository at this point in the history
…afe is not full, add an icon of the rejected guardian
  • Loading branch information
dmitrsosnin committed Sep 27, 2024
1 parent 1febf90 commit 9934576
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OnRejectDialog extends StatelessWidget {
@override
Widget build(BuildContext context) => BottomSheetWidget(
icon: const Icon(Icons.cancel, size: 80),
titleString: 'Guardian rejected the recovery of your Secret',
titleString: 'Guardians have rejected your Secret recovery request',
textSpan: [
const TextSpan(text: 'Secret Recovery process for '),
TextSpan(text: vaultName, style: styleW600),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ class _DiscoveringPeersPageState extends State<DiscoveringPeersPage> {
? GuardianListTile(
guardian: message.peerId,
)
: GuardianListTile.pending(
guardian: message.peerId,
),
: message.isRejected
? GuardianListTile.rejected(
guardian: message.peerId,
)
: GuardianListTile.pending(
guardian: message.peerId,
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ final class VaultSecretRecoveryPresenter extends VaultSecretPresenterBase {
.toList());
requestCompleter.complete(updatedMessage);
nextPage();
} else if (messages.where((e) => e.isRejected).length > vault.redudancy) {
} else if (messages.where((e) => e.isRejected).length >
vault.size - vault.threshold) {
stopListenResponse();
requestCompleter.complete(updatedMessage.copyWith(
status: MessageStatus.rejected,
Expand Down
23 changes: 23 additions & 0 deletions lib/feature/vault/ui/widgets/guardian_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ class GuardianListTile extends StatelessWidget {
subtitle = 'ID: ${guardian.toHexShort()}',
leading = const _GuardianPendingIcon();

GuardianListTile.rejected({
required PeerId guardian,
super.key,
}) : onTap = null,
onLongPress = null,
isWaiting = false,
title = guardian.name,
subtitle = 'ID: ${guardian.toHexShort()}',
leading = const _GuardianRejectedIcon();

final bool isWaiting;
final Widget? leading;
final String title;
Expand Down Expand Up @@ -103,3 +113,16 @@ class _GuardianPendingIcon extends StatelessWidget {
scale: 0.6,
);
}

class _GuardianRejectedIcon extends StatelessWidget {
const _GuardianRejectedIcon();

@override
Widget build(BuildContext context) => StyledIcon(
icon: Icons.close,
scale: 0.6,
outlined: true,
color: Theme.of(context).colorScheme.error,
bgColor: Theme.of(context).colorScheme.primary,
);
}

0 comments on commit 9934576

Please sign in to comment.