Fix routing to home after initial account creation

This commit is contained in:
Brandon Vandegrift 2025-04-03 14:27:56 -04:00
parent f4407e5284
commit e1f081105a
3 changed files with 27 additions and 16 deletions

View file

@ -63,10 +63,13 @@ class _NewAccountPageState extends WindowSetupState<NewAccountPage> {
return false;
}
final isFirstAccount =
AccountRepository.instance.getLocalAccounts().isEmpty;
final writableSuperIdentity = await AccountRepository.instance
.createWithNewSuperIdentity(accountSpec);
GoRouterHelper(context).pushReplacement('/new_account/recovery_key',
extra: [writableSuperIdentity, accountSpec.name]);
extra: [writableSuperIdentity, accountSpec.name, isFirstAccount]);
return true;
} finally {
@ -92,11 +95,15 @@ class _NewAccountPageState extends WindowSetupState<NewAccountPage> {
return StyledScaffold(
appBar: DefaultAppBar(
title: Text(translate('new_account_page.titlebar')),
leading: Navigator.canPop(context)
leading: GoRouterHelper(context).canPop()
? IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
if (GoRouterHelper(context).canPop()) {
GoRouterHelper(context).pop();
} else {
GoRouterHelper(context).go('/');
}
},
)
: null,