startup => specific wallet => xmr/wow syncing/loading fix

This commit is contained in:
julian 2023-03-27 15:21:10 -06:00
parent 6992e91157
commit 88e5e80de7
2 changed files with 41 additions and 10 deletions

View file

@ -14,7 +14,9 @@ import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/biometrics.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
import 'package:stackwallet/utilities/show_loading.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/background.dart';
@ -80,19 +82,47 @@ class _LockscreenViewState extends ConsumerState<LockscreenView> {
if (widget.popOnSuccess) {
Navigator.of(context).pop(widget.routeOnSuccessArguments);
} else {
unawaited(Navigator.of(context).pushReplacementNamed(
widget.routeOnSuccess,
arguments: widget.routeOnSuccessArguments,
));
if (widget.routeOnSuccess == HomeView.routeName &&
widget.routeOnSuccessArguments is String) {
final loadIntoWallet = widget.routeOnSuccess == HomeView.routeName &&
widget.routeOnSuccessArguments is String;
if (loadIntoWallet) {
final walletId = widget.routeOnSuccessArguments as String;
unawaited(Navigator.of(context).pushNamed(WalletView.routeName,
arguments: Tuple2(
final manager =
ref.read(walletsChangeNotifierProvider).getManager(walletId);
if (manager.coin == Coin.monero || manager.coin == Coin.wownero) {
await showLoading(
opaqueBG: true,
whileFuture: manager.initializeExisting(),
context: context,
message: "Loading ${manager.coin.prettyName} wallet...",
);
}
}
if (mounted) {
unawaited(
Navigator.of(context).pushReplacementNamed(
widget.routeOnSuccess,
arguments: widget.routeOnSuccessArguments,
),
);
if (loadIntoWallet) {
final walletId = widget.routeOnSuccessArguments as String;
unawaited(
Navigator.of(context).pushNamed(
WalletView.routeName,
arguments: Tuple2(
walletId,
ref
.read(walletsChangeNotifierProvider)
.getManagerProvider(walletId))));
.getManagerProvider(walletId),
),
),
);
}
}
}
}

View file

@ -10,6 +10,7 @@ Future<T> showLoading<T>({
required String message,
String? subMessage,
bool isDesktop = false,
bool opaqueBG = false,
}) async {
unawaited(
showDialog<void>(
@ -21,7 +22,7 @@ Future<T> showLoading<T>({
color: Theme.of(context)
.extension<StackColors>()!
.overlay
.withOpacity(0.6),
.withOpacity(opaqueBG ? 1.0 : 0.6),
child: CustomLoadingOverlay(
message: message,
subMessage: subMessage,