Account state now survives reload before redirecting to login
This commit is contained in:
@@ -17,14 +17,24 @@ class AccountLoader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Consumer<AccountProvider>(builder: (context, provider, _) {
|
||||
if (provider.account != null) return child;
|
||||
|
||||
if (!provider.restoreAttempted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => provider.restoreIfPossible());
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (provider.isLoading) return const Center(child: CircularProgressIndicator());
|
||||
if (provider.error != null) {
|
||||
postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: provider.error!,
|
||||
);
|
||||
navigateAndReplace(context, Pages.login);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
postNotifyUserOfErrorX(
|
||||
context: context,
|
||||
errorSituation: AppLocalizations.of(context)!.errorLogin,
|
||||
exception: provider.error!,
|
||||
);
|
||||
navigateAndReplace(context, Pages.login);
|
||||
});
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (provider.account == null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => navigateAndReplace(context, Pages.login));
|
||||
|
||||
Reference in New Issue
Block a user