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

Need help notice #1057

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fd69df8
Add dialog when clicking on "Question about app" in faq_view
EffBureau Sep 16, 2024
91279af
Correct intl strings and remove duplicate
EffBureau Sep 16, 2024
1c30978
Change close to cancel
EffBureau Sep 23, 2024
ddc4baf
Test if dialog shows on button tap
EffBureau Sep 23, 2024
f4dddb6
Format imports
EffBureau Sep 23, 2024
4d29b54
Change notice text
EffBureau Sep 23, 2024
28c7cb8
Change url variable names
EffBureau Sep 23, 2024
70d00ea
Add cancel button test
EffBureau Sep 23, 2024
b88a456
Add tests to check if pages still work
EffBureau Sep 23, 2024
6ed7412
Test if tap outside dialog closes it
EffBureau Sep 23, 2024
ec8a181
Format code
EffBureau Sep 23, 2024
02b50dc
Add analytics
EffBureau Sep 23, 2024
e4d82e0
Format code
EffBureau Sep 23, 2024
450253f
Setup analytics service mock
EffBureau Sep 23, 2024
e94f5f2
Remove unused imports
EffBureau Sep 23, 2024
88e55bb
[BOT] Applying version.
EffBureau Sep 23, 2024
f905d57
Merge branch 'master' into need-help-notice
EffBureau Nov 8, 2024
abc3884
Remove unused import
EffBureau Nov 8, 2024
9a68925
Merge branch 'master' into need-help-notice
EffBureau Jan 6, 2025
da6b3e6
Reset login_view to master
EffBureau Jan 6, 2025
c7d6ad1
format code
EffBureau Jan 6, 2025
5b2ea30
Move urls to intl files
EffBureau Jan 6, 2025
1d91fe5
Adapt code to refactor pulled from master
EffBureau Jan 6, 2025
dc05198
Merge branch 'master' into need-help-notice
EffBureau Jan 13, 2025
8db47e6
Revert "format code"
EffBureau Jan 13, 2025
4101a86
Fix tests
EffBureau Jan 13, 2025
8d7eb04
Change forgot_password AppIntl reference
EffBureau Jan 13, 2025
0d2a09b
Remove analytics services from tests
EffBureau Jan 13, 2025
0da69ae
Create need_help_notice_dialog
EffBureau Jan 13, 2025
e08f36f
Remove unused imports
EffBureau Jan 13, 2025
7eaf140
[BOT] Applying pod update.
EffBureau Jan 13, 2025
c9de64d
Move dialog tests
EffBureau Jan 21, 2025
52686fa
Remove "about" from intl variables
EffBureau Jan 21, 2025
f126f2c
Remove tag from viewmodel
EffBureau Jan 21, 2025
6a978e0
Merge branch 'need-help-notice' of https://github.com/ApplETS/Notre-D…
EffBureau Jan 21, 2025
f8bd35e
Remove unused imports
EffBureau Jan 21, 2025
5f9aa25
Use Widget directly in test instead of faq view
EffBureau Feb 12, 2025
6e4c39f
Remove tap outside test
EffBureau Feb 12, 2025
3423288
Merge remote-tracking branch 'origin/master' into need-help-notice
EffBureau Feb 12, 2025
80cef59
Fix imports
EffBureau Mar 6, 2025
d7dcdd3
Formatting
EffBureau Mar 6, 2025
bd2a810
Fix colors
EffBureau Mar 6, 2025
b87159b
Fix colors
EffBureau Mar 6, 2025
6db0f3b
Format
EffBureau Mar 6, 2025
dacd0d0
Remove widget tests from view
EffBureau Mar 6, 2025
fc98486
Fix imports
EffBureau Mar 6, 2025
c44c4f3
Look for Card instead of ElevatedButton
EffBureau Mar 6, 2025
15b883f
[BOT] Applying pod update.
EffBureau Mar 6, 2025
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
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
12 changes: 6 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PODS:
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.4.1):
- FirebaseCore (~> 11.0)
- FirebaseCoreInternal (11.6.0):
- FirebaseCoreInternal (11.7.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.4.0):
- FirebaseCore (~> 11.4)
Expand All @@ -84,7 +84,7 @@ PODS:
- FirebaseSharedSwift (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseRemoteConfigInterop (11.6.0)
- FirebaseRemoteConfigInterop (11.7.0)
- FirebaseSessions (11.4.0):
- FirebaseCore (~> 11.4)
- FirebaseCoreExtension (~> 11.4)
Expand All @@ -94,7 +94,7 @@ PODS:
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (11.6.0)
- FirebaseSharedSwift (11.7.0)
- Flutter (1.0.0)
- flutter_inappwebview_ios (0.0.1):
- Flutter
Expand Down Expand Up @@ -305,13 +305,13 @@ SPEC CHECKSUMS:
FirebaseAnalytics: 3feef9ae8733c567866342a1000691baaa7cad49
FirebaseCore: e0510f1523bc0eb21653cac00792e1e2bd6f1771
FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e
FirebaseCoreInternal: d98ab91e2d80a56d7b246856a8885443b302c0c2
FirebaseCoreInternal: d6c17dafc8dc33614733a8b52df78fcb4394c881
FirebaseCrashlytics: 41bbdd2b514a8523cede0c217aee6ef7ecf38401
FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414
FirebaseRemoteConfig: 7655681d02417bc9b287338edb9d721ff79e1a4a
FirebaseRemoteConfigInterop: e75e348953352a000331eb77caf01e424248e176
FirebaseRemoteConfigInterop: ca12abf9da0003efd3a476b2dff4f7a04fd31b4f
FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b
FirebaseSharedSwift: a4e5dfca3e210633bb3a3dfb94176c019211948b
FirebaseSharedSwift: a45efd84d60ebbfdcdbaebc66948af3630459e62
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_inappwebview_ios: 6f63631e2c62a7c350263b13fa5427aedefe81d4
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
Expand Down
12 changes: 9 additions & 3 deletions l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
"github": "GitHub",
"email": "Email",
"email_subject": "ÉTSMobile Problem",


"faq_questions_about_app_alert_title": "Notice",
"faq_questions_about_app_alert_confirmation": "Please note that if your question is about gaining access to your account, App|ETS cannot help you. \n\nTap on the \"Password assistance\" button to get help",
"faq_questions_about_app_alert_password_assistance": "Password assistance",
"continue_to_mail_app": "Continue to mail app",
"cancel_button_text": "Cancel",
"monets_connection_help_page": "https://partage.etsmtl.ca/fs/en.html",

"close_button_text": "Close",

"title_schedule": "Schedule",
Expand Down Expand Up @@ -239,7 +246,7 @@
"more_settings": "Settings",
"more_log_out": "Log out",
"more_prompt_log_out_confirmation": "Are you sure you want to log out?",
"more_log_out_progress": "Disconnection in progress",
"more_log_out_progress": "Logging you out",

"more_applets_about_details": "ÉTSMobile was conceived by the ApplETS scientific club from the École de technologie supérieure.\n\nApplets is, most importantly, a gathering of students who share a typical enthusiasm for the field of telecommunications and mobile applications. The mission of ApplETS is to train students in mobile development and promote the production of mobile applications within the student community.\n\nFollow us on: ",

Expand Down Expand Up @@ -339,7 +346,6 @@
"progress_bar_suffix": "days",

"in_app_review_title": "Rate us!",
"forgot_password": "Forgot your password?",
"need_help": "Need help?",
"privacy_policy": "Privacy policy",
"actions": "Actions",
Expand Down
8 changes: 7 additions & 1 deletion l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
"email": "Courriel",
"email_subject": "Problème ÉTSMobile",

"faq_questions_about_app_alert_title": "Attention",
"faq_questions_about_app_alert_confirmation": "Veuillez noter que si votre question concerne l'accès à votre compte, le club App|ETS ne peut pas vous aider. \n\nAppuyez sur le bouton \"Assistance mot de passe\" pour obtenir de l'aide",
"faq_questions_about_app_alert_password_assistance": "Assistance mot de passe",
"continue_to_mail_app": "Continuer vers l'application courriel",
"cancel_button_text": "Annuler",
"monets_connection_help_page": "https://partage.etsmtl.ca/fs/fr.html",

"close_button_text": "Fermer",

"title_schedule": "Horaire",
Expand Down Expand Up @@ -343,7 +350,6 @@
"privacy_policy": "Politique de confidentialité",
"questions_and_answers": "Questions et réponses",
"actions": "Actions",
"forgot_password": "Mot de passe oublié?",
"universal_code_example": "Ex: AB12345",
"my_tickets": "Mes billets",
"no_ticket": "Aucun billet",
Expand Down
100 changes: 100 additions & 0 deletions lib/features/app/widgets/need_help_notice_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Flutter imports:
import 'package:flutter/material.dart';
import 'package:notredame/features/more/faq/faq_viewmodel.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:notredame/utils/app_theme.dart';

class NeedHelpNoticeDialog extends AlertDialog {
final FaqViewModel model;
final double radius;
final String link;

const NeedHelpNoticeDialog({
super.key,
required this.model,
required this.link,
this.radius = 5.0,
});

@override
Widget build(BuildContext context) => AlertDialog(
title: Text(
AppIntl.of(context)!.faq_questions_about_app_alert_title,
style: const TextStyle(
color: AppTheme.primary, fontWeight: FontWeight.bold),
),
content: Text(
AppIntl.of(context)!.faq_questions_about_app_alert_confirmation,
style: const TextStyle(fontWeight: FontWeight.bold)),
actions: [
getButtons(context),
],
);

Column getButtons(BuildContext context) {
SizedBox helpPageButton = SizedBox(
width: double.infinity,
child: TextButton.icon(
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all<Color>(AppTheme.primary),
foregroundColor: WidgetStateProperty.all<Color>(
AppTheme.lightThemeBackground),
textStyle: WidgetStateProperty.all<TextStyle>(
const TextStyle(fontWeight: FontWeight.bold)),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(radius)))),
onPressed: () {
model.launchWebsite(
AppIntl.of(context)!.monets_connection_help_page);
},
icon: const Icon(Icons.help_center),
label: Text(AppIntl.of(context)!
.faq_questions_about_app_alert_password_assistance),
),
);

SizedBox continueButton = SizedBox(
width: double.infinity,
child: TextButton.icon(
style: ButtonStyle(
backgroundColor:
WidgetStateProperty.all<Color>(AppTheme.primary),
foregroundColor: WidgetStateProperty.all<Color>(
AppTheme.lightThemeBackground),
textStyle: WidgetStateProperty.all<TextStyle>(
const TextStyle(fontWeight: FontWeight.bold)),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(radius)))),
onPressed: () => model.openMail(link, context),
icon: const Icon(Icons.mail),
label: Text(AppIntl.of(context)!.continue_to_mail_app),
),
);

SizedBox cancelButton = SizedBox(
width: double.infinity,
child: TextButton.icon(
onPressed: () => Navigator.of(context).pop(),
style: ButtonStyle(
textStyle: WidgetStateProperty.all<TextStyle>(
const TextStyle(fontWeight: FontWeight.bold)),
shape: WidgetStateProperty.all(RoundedRectangleBorder(
side: const BorderSide(
color: AppTheme.primary, width: 2.0),
borderRadius: BorderRadius.circular(radius)))),
icon: const Icon(Icons.cancel),
label: Text(AppIntl.of(context)!.cancel_button_text)),
);

return Column(
children: [
helpPageButton,
continueButton,
cancelButton,
],
);
}
}
7 changes: 6 additions & 1 deletion lib/features/more/faq/faq_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
// Package imports:
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:notredame/features/app/widgets/need_help_notice_dialog.dart';
import 'package:stacked/stacked.dart';

// Project imports:
Expand Down Expand Up @@ -186,7 +187,11 @@ class _FaqViewState extends State<FaqView> {
if (type.name == ActionType.webview.name) {
model.launchWebsite(link);
} else if (type.name == ActionType.email.name) {
model.openMail(link, context);
showDialog(
context: context,
builder: (BuildContext context) {
return NeedHelpNoticeDialog(model: model, link: link);
});
}
},
style: ButtonStyle(
Expand Down
9 changes: 3 additions & 6 deletions lib/features/more/faq/faq_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import 'package:stacked/stacked.dart';

// Project imports:
import 'package:notredame/constants/app_info.dart';
import 'package:notredame/features/app/analytics/analytics_service.dart';
import 'package:notredame/features/app/integration/launch_url_service.dart';
import 'package:notredame/features/more/settings/settings_manager.dart';
import 'package:notredame/utils/locator.dart';

class FaqViewModel extends BaseViewModel {
static const String tag = "FaqViewModel";

final SettingsManager _settingsManager = locator<SettingsManager>();

final LaunchUrlService _launchUrlService = locator<LaunchUrlService>();
Expand All @@ -30,10 +31,6 @@ class FaqViewModel extends BaseViewModel {
subject = AppIntl.of(context)!.email_subject;
}

try {
_launchUrlService.writeEmail(addressEmail, subject);
} catch (e) {
locator<AnalyticsService>().logError("login_view", "Cannot send email.");
}
_launchUrlService.writeEmail(addressEmail, subject);
}
}
3 changes: 1 addition & 2 deletions lib/features/welcome/widgets/forgot_password.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class _ForgotPasswordState extends State<ForgotPassword>{
padding: const EdgeInsets.only(top: 4),
child: InkWell(
child: Text(
AppIntl.of(context)!
.forgot_password,
AppIntl.of(context)!.login_password_forgotten,
style: const TextStyle(
decoration:
TextDecoration.underline,
Expand Down
90 changes: 87 additions & 3 deletions test/features/more/faq/faq_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void main() {
setUp(() async {
setupLaunchUrlServiceMock();
setupNetworkingServiceMock();

settingsManagerMock = setupSettingsManagerMock();
appIntl = await setupAppIntl();
});
Expand All @@ -33,7 +34,6 @@ void main() {
SettingsManagerMock.stubLocale(settingsManagerMock);

await tester.pumpWidget(localizedWidget(child: const FaqView()));
await tester.pumpAndSettle(const Duration(milliseconds: 800));

final Faq faq = Faq();

Expand All @@ -45,8 +45,7 @@ void main() {
find.text(faq.actions[2].title["en"]!, skipOffstage: false);
final action4 =
find.text(faq.actions[3].title["en"]!, skipOffstage: false);

await tester.pump();

await tester.drag(find.byType(ListView), const Offset(0.0, -300));
await tester.pump();

Expand All @@ -56,6 +55,91 @@ void main() {
expect(action4, findsOneWidget);
});

testWidgets('tapping "Questions About ETS Button" shows dialog',
(WidgetTester tester) async {
SettingsManagerMock.stubLocale(settingsManagerMock);

await tester.pumpWidget(localizedWidget(child: const FaqView()));

final Faq faq = Faq();

await tester.drag(find.byType(ListView), const Offset(0.0, -500));
await tester.pumpAndSettle();

final questionsAbtETSMobileBtn =
find.widgetWithText(ElevatedButton, faq.actions[3].title["en"]!);
expect(questionsAbtETSMobileBtn, findsOneWidget);

await tester.tap(questionsAbtETSMobileBtn);
await tester.pumpAndSettle();

final dialog = find.byType(AlertDialog);

expect(dialog, findsOne);
});

testWidgets('tapping "Cancel" closes dialog',
(WidgetTester tester) async {
SettingsManagerMock.stubLocale(settingsManagerMock);

await tester.pumpWidget(localizedWidget(child: const FaqView()));

final Faq faq = Faq();

await tester.drag(find.byType(ListView), const Offset(0.0, -500));
await tester.pumpAndSettle();

final questionsAbtETSMobileBtn =
find.widgetWithText(ElevatedButton, faq.actions[3].title["en"]!);
expect(questionsAbtETSMobileBtn, findsOneWidget);

await tester.tap(questionsAbtETSMobileBtn);
await tester.pumpAndSettle();

Finder dialog = find.byType(AlertDialog);
expect(dialog, findsOne);

final cancelButton = find.byIcon(Icons.cancel);
expect(cancelButton, findsAny);

await tester.tap(cancelButton);
await tester.pumpAndSettle();

dialog = find.byType(AlertDialog);
expect(dialog, findsNothing);
});

testWidgets('tapping outside dialog closes it',
(WidgetTester tester) async {
SettingsManagerMock.stubLocale(settingsManagerMock);

await tester.pumpWidget(localizedWidget(child: const FaqView()));

final Faq faq = Faq();

await tester.drag(find.byType(ListView), const Offset(0.0, -500));
await tester.pumpAndSettle();

final questionsAbtETSMobileBtn =
find.widgetWithText(ElevatedButton, faq.actions[3].title["en"]!);
expect(questionsAbtETSMobileBtn, findsOneWidget);

await tester.tap(questionsAbtETSMobileBtn);
await tester.pumpAndSettle();

Finder dialog = find.byType(AlertDialog);
expect(dialog, findsOne);

final cancelButton = find.byIcon(Icons.cancel);
expect(cancelButton, findsAny);

await tester.tapAt(Offset.zero);
await tester.pumpAndSettle();

dialog = find.byType(AlertDialog);
expect(dialog, findsNothing);
});

testWidgets('has 2 subtitles', (WidgetTester tester) async {
SettingsManagerMock.stubLocale(settingsManagerMock);

Expand Down
Loading
Loading