Skip to content

Commit

Permalink
Merge pull request #663 from breez/661-add-refunds-to-warnings
Browse files Browse the repository at this point in the history
add refunds to warnings
  • Loading branch information
ubbabeck authored Oct 9, 2023
2 parents 5823fe0 + 66c2fbc commit 213ed2c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/routes/home/widgets/app_bar/account_required_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import 'package:c_breez/bloc/backup/backup_state.dart';
import 'package:c_breez/bloc/ext/block_builder_extensions.dart';
import 'package:c_breez/bloc/lsp/lsp_bloc.dart';
import 'package:c_breez/bloc/lsp/lsp_state.dart';
import 'package:c_breez/bloc/refund/refund_bloc.dart';
import 'package:c_breez/routes/home/widgets/app_bar/warning_action.dart';
import 'package:c_breez/routes/home/widgets/enable_backup_dialog.dart';
import 'package:c_breez/routes/home/widgets/rotator.dart';
import 'package:c_breez/routes/subswap/swap/get_refund/get_refund_page.dart';
import 'package:c_breez/services/injector.dart';
import 'package:c_breez/widgets/backup_in_progress_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class AccountRequiredActionsIndicator extends StatelessWidget {
const AccountRequiredActionsIndicator({
Expand All @@ -24,6 +27,8 @@ class AccountRequiredActionsIndicator extends StatelessWidget {
return BlocBuilder3<AccountBloc, AccountState, LSPBloc, LspState?, BackupBloc, BackupState?>(
builder: (context, accState, lspState, backupState) {
final navigatorState = Navigator.of(context);
final refundBloc = context.read<RefundBloc>();
final refundState = refundBloc.state;

List<Widget> warnings = [];
int walletBalance = accState.walletBalance;
Expand Down Expand Up @@ -99,6 +104,16 @@ class AccountRequiredActionsIndicator extends StatelessWidget {
);
}

if (refundState.refundables != null && refundState.refundables!.isNotEmpty) {
warnings.add(
WarningAction(
() {
showDialog(context: context, builder: (_) => GetRefundPage(refundBloc: refundBloc));
},
),
);
}

if (warnings.isEmpty) {}

return Row(
Expand Down

0 comments on commit 213ed2c

Please sign in to comment.