Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added about zulip option to main menu #1146

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ abstract class ZulipLocalizations {
/// **'Switch account'**
String get switchAccountButton;

/// Label for the 'About Zulip' option in the main menu.
///
/// In en, this message translates to:
/// **'About Zulip'**
String get aboutZulipMenuItem;

/// Message that appears on the loading screen after waiting for some time.
///
/// In en, this message translates to:
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 3 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get switchAccountButton => 'Switch account';

@override
String get aboutZulipMenuItem => 'About Zulip';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
19 changes: 19 additions & 0 deletions lib/widgets/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'store.dart';
import 'subscription_list.dart';
import 'text.dart';
import 'theme.dart';
import 'about_zulip.dart';

enum _HomePageTab {
inbox,
Expand Down Expand Up @@ -259,6 +260,7 @@ void _showMainMenu(BuildContext context, {
// TODO(#1094): Users
const _MyProfileButton(),
const _SwitchAccountButton(),
const _AboutZulipButton(),
// TODO(#198): Set my status
// const SizedBox(height: 8),
// TODO(#97): Settings
Expand Down Expand Up @@ -551,6 +553,23 @@ class _SwitchAccountButton extends _MenuButton {
}
}

class _AboutZulipButton extends _MenuButton {
const _AboutZulipButton();

@override
IconData get icon => Icons.info;

@override
String label(ZulipLocalizations zulipLocalizations) {
return zulipLocalizations.aboutZulipMenuItem;
}

@override
void onPressed(BuildContext context) {
Navigator.of(context).push(AboutZulipPage.buildRoute(context));
}
}

/// Apply [Transform.scale] to the child widget when tapped, and reset its scale
/// when released, while animating the transitions.
class AnimatedScaleOnTap extends StatefulWidget {
Expand Down
15 changes: 15 additions & 0 deletions test/widgets/home_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter_checks/flutter_checks.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:zulip/api/model/events.dart';
import 'package:zulip/model/store.dart';
import 'package:zulip/widgets/about_zulip.dart';
import 'package:zulip/widgets/app.dart';
import 'package:zulip/widgets/app_bar.dart';
import 'package:zulip/widgets/home.dart';
Expand Down Expand Up @@ -105,6 +106,10 @@ void main () {
final combinedFeedMenuIconFinder = find.descendant(
of: find.byType(BottomSheet),
matching: find.byIcon(ZulipIcons.message_feed));
final aboutZulipMenuIconFinder = find.descendant(
of: find.byType(BottomSheet),
matching: find.byIcon(Icons.info));


Future<void> tapOpenMenu(WidgetTester tester) async {
await tester.tap(find.byIcon(ZulipIcons.menu));
Expand Down Expand Up @@ -215,6 +220,16 @@ void main () {
check(find.byType(ProfilePage)).findsOne();
check(find.text(eg.selfUser.fullName)).findsAny();
});

testWidgets('_AboutZulipButton', (tester) async {
await prepare(tester);
await tapOpenMenu(tester);

await tester.tap(aboutZulipMenuIconFinder);
await tester.pump(Duration.zero); // tap the button
await tester.pump(const Duration(milliseconds: 250)); // wait for animation
check(find.byType(AboutZulipPage)).findsOne();
});
});

group('_LoadingPlaceholderPage', () {
Expand Down
Loading