Skip to content

Commit

Permalink
Merge pull request #1444 from get10101/fix/exception-when-funding-the…
Browse files Browse the repository at this point in the history
…-wallet

fix: Use go to wallet screen instead of pop
  • Loading branch information
bonomat authored Oct 6, 2023
2 parents 04c626c + 4672226 commit 1b77451
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 2 additions & 7 deletions mobile/lib/features/wallet/onboarding/fund_wallet_modal.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:f_logs/model/flog/flog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_10101/bridge_generated/bridge_definitions.dart' as bridge;
Expand All @@ -7,6 +6,7 @@ import 'package:get_10101/common/snack_bar.dart';
import 'package:get_10101/common/value_data_row.dart';
import 'package:get_10101/features/wallet/application/faucet_service.dart';
import 'package:get_10101/features/wallet/payment_claimed_change_notifier.dart';
import 'package:get_10101/features/wallet/wallet_screen.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
Expand Down Expand Up @@ -65,12 +65,7 @@ class _FundWalletModalState extends State<FundWalletModal> {
const style = TextStyle(fontSize: 20);

if (context.watch<PaymentClaimedChangeNotifier>().isClaimed()) {
// routing is not allowed during building a widget, hence we need to register the route navigation after the widget has been build.
WidgetsBinding.instance.addPostFrameCallback((_) {
FLog.debug(text: "Payment received!");
GoRouter.of(context).pop();
GoRouter.of(context).pop();
});
GoRouter.of(context).go(WalletScreen.route);
}

return SafeArea(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ import 'package:get_10101/common/application/event_service.dart';
class PaymentClaimedChangeNotifier extends ChangeNotifier implements Subscriber {
bool _claimed = false;

void waitForPayment() {
_claimed = false;
}
void waitForPayment() => _claimed = false;

bool isClaimed() {
return _claimed;
}
bool isClaimed() => _claimed;

@override
void notify(Event event) {
Expand Down

0 comments on commit 1b77451

Please sign in to comment.