Skip to content

Commit

Permalink
nav: Go straight to inbox on launch, when an account available
Browse files Browse the repository at this point in the history
Fixes: zulip#516
  • Loading branch information
gnprice committed Feb 17, 2024
1 parent 535f47c commit 10bac11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class ZulipApp extends StatelessWidget {
if (initialAccountId != null) ...[
MaterialAccountWidgetRoute(accountId: initialAccountId,
page: const HomePage()),
MaterialAccountWidgetRoute(accountId: initialAccountId,
page: const InboxPage()),
],
];
});
Expand Down
6 changes: 5 additions & 1 deletion test/widgets/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:checks/checks.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:zulip/widgets/app.dart';
import 'package:zulip/widgets/inbox.dart';
import 'package:zulip/widgets/page.dart';

import '../example_data.dart' as eg;
Expand Down Expand Up @@ -31,7 +32,7 @@ void main() {
]);
});

testWidgets('when have accounts, go to home page for first account', (tester) async {
testWidgets('when have accounts, go to inbox for first account', (tester) async {
addTearDown(testBinding.reset);

// We'll need per-account data for the account that a page will be opened
Expand All @@ -44,6 +45,9 @@ void main() {
(Subject it) => it.isA<MaterialAccountWidgetRoute>()
..accountId.equals(eg.selfAccount.id)
..page.isA<HomePage>(),
(Subject it) => it.isA<MaterialAccountWidgetRoute>()
..accountId.equals(eg.selfAccount.id)
..page.isA<InboxPage>(),
]);
});
});
Expand Down

0 comments on commit 10bac11

Please sign in to comment.