Skip to content

Commit

Permalink
Display the correct tooltip for warning actions
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Oct 17, 2023
1 parent 842bbf2 commit e57bc5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/bloc/lnurl/lnurl_model.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:breez/bloc/user_profile/currency.dart';
import 'package:breez/services/breezlib/data/messages.pb.dart';
import 'package:fixnum/fixnum.dart';

Expand Down
21 changes: 18 additions & 3 deletions lib/routes/account_required_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,32 @@ class AccountRequiredActionsIndicatorState
Widget _buildLoader(BackupState backupState, AccountModel account) {
final backupBloc = AppBlocsProvider.of<BackupBloc>(context);
final accountBloc = AppBlocsProvider.of<AccountBloc>(context);
final texts = context.texts();

Widget Function(BuildContext) dialogBuilder;
String tooltip = "";

if (backupState?.inProgress == true) {
dialogBuilder = (_) => buildBackupInProgressDialog(
context,
backupBloc.backupStateStream,
onFinished: () {},
);
tooltip = texts.account_required_actions_backup;
} else if (account?.transferringOnChainDeposit == true) {
dialogBuilder = (_) => buildTransferFundsInProgressDialog(
context,
accountBloc.accountStream,
);
tooltip = texts.transferring_funds_title;
}

if (dialogBuilder != null) {
return WarningAction(
() {
showDialog(context: context, builder: dialogBuilder);
},
tooltip: tooltip,
iconWidget: Rotator(
child: Image(
image: const AssetImage("src/icon/sync.png"),
Expand Down Expand Up @@ -207,6 +212,7 @@ class AccountRequiredActionsIndicatorState
bool hasError,
Object backupError,
) {
final texts = context.texts();
final themeData = Theme.of(context);
final navigatorState = Navigator.of(context);

Expand All @@ -215,7 +221,10 @@ class AccountRequiredActionsIndicatorState

if (walletBalance > 0 && !accountSettings.ignoreWalletBalance) {
warnings.add(
WarningAction(() => navigatorState.pushNamed("/send_coins")),
WarningAction(
() => navigatorState.pushNamed("/send_coins"),
tooltip: texts.unexpected_funds_title,
),
);
}

Expand All @@ -230,6 +239,7 @@ class AccountRequiredActionsIndicatorState
builder: (_) => const EnableBackupDialog(),
);
},
tooltip: texts.account_required_actions_backup,
),
);
}
Expand All @@ -251,6 +261,7 @@ class AccountRequiredActionsIndicatorState
builder: (_) => CloseWarningDialog(inactiveWarningDuration),
);
},
tooltip: texts.close_warning_dialog_title,
),
);
}
Expand All @@ -274,6 +285,7 @@ class AccountRequiredActionsIndicatorState
builder: (_) => const SwapRefundDialog(),
);
},
tooltip: texts.funds_over_limit_dialog_on_chain_transaction,
),
);
}
Expand All @@ -285,6 +297,7 @@ class AccountRequiredActionsIndicatorState
() => accountBloc.userActionsSink.add(
ChangeSyncUIState(SyncUIState.BLOCKING),
),
tooltip: texts.handler_sync_ui_message,
iconWidget: Rotator(
child: Image(
image: const AssetImage("src/icon/sync.png"),
Expand Down Expand Up @@ -312,6 +325,7 @@ class AccountRequiredActionsIndicatorState
navigatorState.pushNamed("/select_lsp");
}
},
tooltip: texts.account_page_activation_provider_label,
),
);
}
Expand All @@ -331,10 +345,12 @@ class AccountRequiredActionsIndicatorState
class WarningAction extends StatefulWidget {
final void Function() onTap;
final Widget iconWidget;
final String tooltip;

const WarningAction(
this.onTap, {
this.iconWidget,
this.tooltip = "",
});

@override
Expand Down Expand Up @@ -376,7 +392,6 @@ class WarningActionState extends State<WarningAction>
@override
Widget build(BuildContext context) {
final themeData = Theme.of(context);
final texts = context.texts();

return IconButton(
iconSize: 45.0,
Expand All @@ -392,7 +407,7 @@ class WarningActionState extends State<WarningAction>
),
),
),
tooltip: texts.account_required_actions_backup,
tooltip: widget.tooltip,
onPressed: widget.onTap,
);
}
Expand Down

0 comments on commit e57bc5a

Please sign in to comment.