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: #516
  • Loading branch information
gnprice authored and chrisbobbe committed Feb 22, 2024
1 parent cbca1e2 commit 256fa7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class ZulipApp extends StatelessWidget {
MaterialWidgetRoute(page: const ChooseAccountPage()),
if (initialAccountId != null) ...[
HomePage.buildRoute(accountId: initialAccountId),
InboxPage.buildRoute(accountId: initialAccountId),
],
];
});
Expand Down
4 changes: 4 additions & 0 deletions test/notifications_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:zulip/model/narrow.dart';
import 'package:zulip/model/store.dart';
import 'package:zulip/notifications.dart';
import 'package:zulip/widgets/app.dart';
import 'package:zulip/widgets/inbox.dart';
import 'package:zulip/widgets/message_list.dart';
import 'package:zulip/widgets/page.dart';

Expand Down Expand Up @@ -198,6 +199,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>(),
],
];
check(pushedRoutes.take(expected.length)).deepEquals(expected);
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 256fa7e

Please sign in to comment.