Skip to content

Commit

Permalink
Merge pull request #22 from acs-upb-mobile/privacy_policy
Browse files Browse the repository at this point in the history
Privacy policy & contributing link
  • Loading branch information
IoanaAlexandru authored Sep 7, 2020
2 parents 95a221d + ff0b634 commit f6054e0
Show file tree
Hide file tree
Showing 19 changed files with 358 additions and 198 deletions.
Binary file modified assets/fonts/CustomIcons/CustomIcons.ttf
Binary file not shown.
61 changes: 52 additions & 9 deletions lib/authentication/view/sign_up_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import 'package:acs_upb_mobile/pages/filter/model/filter.dart';
import 'package:acs_upb_mobile/pages/filter/service/filter_provider.dart';
import 'package:acs_upb_mobile/resources/banner.dart';
import 'package:acs_upb_mobile/resources/locale_provider.dart';
import 'package:acs_upb_mobile/resources/utils.dart';
import 'package:acs_upb_mobile/resources/validator.dart';
import 'package:acs_upb_mobile/widgets/button.dart';
import 'package:acs_upb_mobile/widgets/form/form.dart';
import 'package:acs_upb_mobile/widgets/toast.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand All @@ -26,6 +28,7 @@ class _SignUpViewState extends State<SignUpView> {
Filter filter;
List<FilterNode> nodes;
FilterProvider filterProvider;
bool agreedToPolicy = false;

void _fetchFilter() async {
// Fetch filter for dropdown buttons
Expand Down Expand Up @@ -85,15 +88,13 @@ class _SignUpViewState extends State<SignUpView> {
},
),
FormItem(
label: S.of(context).labelFirstName,
hint: S.of(context).hintFirstName,
autofillHints: [AutofillHints.givenName]
),
label: S.of(context).labelFirstName,
hint: S.of(context).hintFirstName,
autofillHints: [AutofillHints.givenName]),
FormItem(
label: S.of(context).labelLastName,
hint: S.of(context).hintLastName,
autofillHints: [AutofillHints.familyName]
),
label: S.of(context).labelLastName,
hint: S.of(context).hintLastName,
autofillHints: [AutofillHints.familyName]),
];
return formItems;
}
Expand Down Expand Up @@ -145,15 +146,57 @@ class _SignUpViewState extends State<SignUpView> {
return items;
}

Widget _privacyPolicy() {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Row(
children: [
Checkbox(
value: agreedToPolicy,
visualDensity: VisualDensity.compact,
onChanged: (value) => setState(() => agreedToPolicy = value),
),
Expanded(
child: RichText(
text: TextSpan(
style: Theme.of(context).textTheme.subtitle1,
children: [
TextSpan(text: S.of(context).messageIAgreeToThe),
TextSpan(
text: S.of(context).labelPrivacyPolicy,
style: Theme.of(context)
.accentTextTheme
.subtitle1
.apply(fontWeightDelta: 2),
recognizer: TapGestureRecognizer()
..onTap = () => Utils.launchURL(
'https://www.websitepolicies.com/policies/view/IIUFv381',
context: context)),
TextSpan(text: '.'),
]),
),
),
],
),
);
}

AppForm _buildForm(BuildContext context) {
AuthProvider authProvider = Provider.of(context);

return AppForm(
title: S.of(context).actionSignUp,
items: _buildFormItems(),
trailing: _dropdownTree(context),
trailing: _dropdownTree(context) + [_privacyPolicy()],
submitOnEnter: false,
onSubmitted: (Map<String, String> fields) async {
if (!agreedToPolicy) {
AppToast.show(S.of(context).warningAgreeTo +
S.of(context).labelPrivacyPolicy +
'.');
return;
}

fields[S.of(context).labelEmail] += S.of(context).stringEmailDomain;
nodes.asMap().forEach((i, node) {
if (i > 0) {
Expand Down
5 changes: 5 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MessageLookup extends MessageLookupByLibrary {
"actionAddEvent" : MessageLookupByLibrary.simpleMessage("Add event"),
"actionAddShortcut" : MessageLookupByLibrary.simpleMessage("Add shortcut"),
"actionAddWebsite" : MessageLookupByLibrary.simpleMessage("Add website"),
"actionContribute" : MessageLookupByLibrary.simpleMessage("Contribute"),
"actionDeleteAccount" : MessageLookupByLibrary.simpleMessage("Delete account"),
"actionDeleteEvent" : MessageLookupByLibrary.simpleMessage("Delete event"),
"actionDeleteShortcut" : MessageLookupByLibrary.simpleMessage("Delete shortcut"),
Expand Down Expand Up @@ -91,6 +92,7 @@ class MessageLookup extends MessageLookupByLibrary {
"hintPoints" : MessageLookupByLibrary.simpleMessage("4.0"),
"hintWebsiteLabel" : MessageLookupByLibrary.simpleMessage("Google"),
"hintWebsiteLink" : MessageLookupByLibrary.simpleMessage("http://google.com"),
"infoAppIsOpenSource" : MessageLookupByLibrary.simpleMessage("ACS UPB Mobile is open source."),
"infoPassword" : MessageLookupByLibrary.simpleMessage("It must contain lower and uppercase letters, one number and one special character, and have a minimum length of 8."),
"infoPasswordResetEmailSent" : MessageLookupByLibrary.simpleMessage("Please check your inbox for the password reset e-mail."),
"infoRelevance" : MessageLookupByLibrary.simpleMessage("Try to choose the most restrictive category."),
Expand All @@ -112,6 +114,7 @@ class MessageLookup extends MessageLookupByLibrary {
"labelPassword" : MessageLookupByLibrary.simpleMessage("Password"),
"labelPoints" : MessageLookupByLibrary.simpleMessage("Points"),
"labelPreview" : MessageLookupByLibrary.simpleMessage("Preview"),
"labelPrivacyPolicy" : MessageLookupByLibrary.simpleMessage("Privacy Policy"),
"labelRelevance" : MessageLookupByLibrary.simpleMessage("Relevance"),
"labelSemester" : MessageLookupByLibrary.simpleMessage("Semester"),
"labelStart" : MessageLookupByLibrary.simpleMessage("Start"),
Expand All @@ -130,6 +133,7 @@ class MessageLookup extends MessageLookupByLibrary {
"messageDeleteWebsite" : MessageLookupByLibrary.simpleMessage("Are you sure you want to delete this website?"),
"messageEmailNotVerified" : MessageLookupByLibrary.simpleMessage("Account is not verified."),
"messageGetStartedPlusButton" : MessageLookupByLibrary.simpleMessage("Get started by pressing the + button above."),
"messageIAgreeToThe" : MessageLookupByLibrary.simpleMessage("I agree to the "),
"messageNewUser" : MessageLookupByLibrary.simpleMessage("New user?"),
"messageNoClassesYet" : MessageLookupByLibrary.simpleMessage("You have not added any classes yet."),
"messageResetPassword" : MessageLookupByLibrary.simpleMessage("Enter your e-mai in order to receive instructions on how to reset your password."),
Expand Down Expand Up @@ -183,6 +187,7 @@ class MessageLookup extends MessageLookupByLibrary {
"uniEventTypeSeminar" : MessageLookupByLibrary.simpleMessage("Seminar"),
"uniEventTypeSports" : MessageLookupByLibrary.simpleMessage("Sports"),
"uniEventTypeTest" : MessageLookupByLibrary.simpleMessage("Test"),
"warningAgreeTo" : MessageLookupByLibrary.simpleMessage("You need to agree to the "),
"warningAuthenticationNeeded" : MessageLookupByLibrary.simpleMessage("Please authenticate in order to access this feature."),
"warningEmailInUse" : m5,
"warningFieldCannotBeEmpty" : MessageLookupByLibrary.simpleMessage("Field cannot be empty."),
Expand Down
5 changes: 5 additions & 0 deletions lib/generated/intl/messages_ro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class MessageLookup extends MessageLookupByLibrary {
"actionAddEvent" : MessageLookupByLibrary.simpleMessage("Adaugă eveniment"),
"actionAddShortcut" : MessageLookupByLibrary.simpleMessage("Adaugă scurtătură"),
"actionAddWebsite" : MessageLookupByLibrary.simpleMessage("Adaugă website"),
"actionContribute" : MessageLookupByLibrary.simpleMessage("Contribuie"),
"actionDeleteAccount" : MessageLookupByLibrary.simpleMessage("Ștergere cont"),
"actionDeleteEvent" : MessageLookupByLibrary.simpleMessage("Șterge eveniment"),
"actionDeleteShortcut" : MessageLookupByLibrary.simpleMessage("Șterge scurtătură"),
Expand Down Expand Up @@ -91,6 +92,7 @@ class MessageLookup extends MessageLookupByLibrary {
"hintPoints" : MessageLookupByLibrary.simpleMessage("4.0"),
"hintWebsiteLabel" : MessageLookupByLibrary.simpleMessage("Google"),
"hintWebsiteLink" : MessageLookupByLibrary.simpleMessage("http://google.com"),
"infoAppIsOpenSource" : MessageLookupByLibrary.simpleMessage("ACS UPB Mobile este open source."),
"infoPassword" : MessageLookupByLibrary.simpleMessage("Aceasta trebuie să conțină majuscule, minuscule și cel puțin un număr sau un simbol, având minimum 8 caractere."),
"infoPasswordResetEmailSent" : MessageLookupByLibrary.simpleMessage("Please check your inbox for the password reset e-mail."),
"infoRelevance" : MessageLookupByLibrary.simpleMessage("Încercați să selectați cea mai restrictivă categorie."),
Expand All @@ -112,6 +114,7 @@ class MessageLookup extends MessageLookupByLibrary {
"labelPassword" : MessageLookupByLibrary.simpleMessage("Parolă"),
"labelPoints" : MessageLookupByLibrary.simpleMessage("Puncte"),
"labelPreview" : MessageLookupByLibrary.simpleMessage("Previzualizare"),
"labelPrivacyPolicy" : MessageLookupByLibrary.simpleMessage("Privacy Policy"),
"labelRelevance" : MessageLookupByLibrary.simpleMessage("Relevanță"),
"labelSemester" : MessageLookupByLibrary.simpleMessage("Semestrul"),
"labelStart" : MessageLookupByLibrary.simpleMessage("Început"),
Expand All @@ -130,6 +133,7 @@ class MessageLookup extends MessageLookupByLibrary {
"messageDeleteWebsite" : MessageLookupByLibrary.simpleMessage("Sunteți sigur că doriți să ștergeți acest website?"),
"messageEmailNotVerified" : MessageLookupByLibrary.simpleMessage("Contul nu este verificat."),
"messageGetStartedPlusButton" : MessageLookupByLibrary.simpleMessage("Începeți prin a apăsa butonul + de mai sus."),
"messageIAgreeToThe" : MessageLookupByLibrary.simpleMessage("Sunt de acord cu "),
"messageNewUser" : MessageLookupByLibrary.simpleMessage("Utilizator nou?"),
"messageNoClassesYet" : MessageLookupByLibrary.simpleMessage("Nu ați adăugat nici o materie încă."),
"messageResetPassword" : MessageLookupByLibrary.simpleMessage("Introduceți mail-ul pentru a primi instrucțiuni de resetare a parolei."),
Expand Down Expand Up @@ -183,6 +187,7 @@ class MessageLookup extends MessageLookupByLibrary {
"uniEventTypeSeminar" : MessageLookupByLibrary.simpleMessage("Seminar"),
"uniEventTypeSports" : MessageLookupByLibrary.simpleMessage("Sport"),
"uniEventTypeTest" : MessageLookupByLibrary.simpleMessage("Test"),
"warningAgreeTo" : MessageLookupByLibrary.simpleMessage("Trebuie să fiți de acord cu "),
"warningAuthenticationNeeded" : MessageLookupByLibrary.simpleMessage("Autentificați-vă pentru a accesa această funcționalitate."),
"warningEmailInUse" : m5,
"warningFieldCannotBeEmpty" : MessageLookupByLibrary.simpleMessage("Câmpul nu poate fi gol."),
Expand Down
51 changes: 51 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"labelUnknown": "Unknown",
"labelEvaluation": "Evaluation",
"labelPoints": "Points",
"labelPrivacyPolicy": "Privacy Policy",

"sectionShortcuts": "Shortcuts",
"sectionEvents": "Events",
Expand Down Expand Up @@ -77,6 +78,7 @@
"actionDeleteShortcut": "Delete shortcut",
"actionShowMore": "Show more",
"actionEditGrading": "Edit grading",
"actionContribute": "Contribute",

"errorSomethingWentWrong": "Something went wrong.",
"errorPasswordsDiffer": "The two passwords differ.",
Expand Down Expand Up @@ -113,6 +115,7 @@
"warningFieldCannotBeEmpty": "Field cannot be empty.",
"warningFieldCannotBeZero": "Field cannot be zero.",
"warningNoneYet": "None yet",
"warningAgreeTo": "You need to agree to the ",

"navigationHome": "Home",
"navigationTimetable": "Timetable",
Expand Down Expand Up @@ -180,11 +183,13 @@
"messageShortcutDeleted": "Shortcut deleted successfully.",
"messageNoClassesYet": "You have not added any classes yet.",
"messageGetStartedPlusButton": "Get started by pressing the + button above.",
"messageIAgreeToThe": "I agree to the ",

"infoPasswordResetEmailSent": "Please check your inbox for the password reset e-mail.",
"infoRelevance": "Try to choose the most restrictive category.",
"infoRelevanceExample": "For instance, if something is only relevant for \"314CB\" and \"315CB\", don't just set \"CB\".",
"infoPassword": "It must contain lower and uppercase letters, one number and one special character, and have a minimum length of 8.",
"infoAppIsOpenSource": "ACS UPB Mobile is open source.",

"stringEmailDomain": "@stud.acs.upb.ro",
"stringAnonymous": "Anonymous",
Expand Down
5 changes: 5 additions & 0 deletions lib/l10n/intl_ro.arb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"labelUnknown": "Necunoscut",
"labelEvaluation": "Evaluare",
"labelPoints": "Puncte",
"labelPrivacyPolicy": "Privacy Policy",

"sectionShortcuts": "Scurtături",
"sectionEvents": "Evenimente",
Expand Down Expand Up @@ -77,6 +78,7 @@
"actionDeleteShortcut": "Șterge scurtătură",
"actionShowMore": "Arată mai multe",
"actionEditGrading": "Modifică punctaj",
"actionContribute": "Contribuie",

"errorSomethingWentWrong": "A apărut o problemă.",
"errorPasswordsDiffer": "Cele două parole diferă.",
Expand Down Expand Up @@ -113,6 +115,7 @@
"warningFieldCannotBeEmpty": "Câmpul nu poate fi gol.",
"warningFieldCannotBeZero": "Câmpul nu poate fi zero.",
"warningNoneYet": "Nu există încă",
"warningAgreeTo": "Trebuie să fiți de acord cu ",

"navigationHome": "Acasă",
"navigationTimetable": "Orar",
Expand Down Expand Up @@ -180,11 +183,13 @@
"messageShortcutDeleted": "Scurtătura a fost ștearsă cu succes.",
"messageNoClassesYet": "Nu ați adăugat nici o materie încă.",
"messageGetStartedPlusButton": "Începeți prin a apăsa butonul + de mai sus.",
"messageIAgreeToThe": "Sunt de acord cu ",

"infoPasswordResetEmailSent": "Please check your inbox for the password reset e-mail.",
"infoRelevance": "Încercați să selectați cea mai restrictivă categorie.",
"infoRelevanceExample": "De exemplu, dacă ceva este relevant doar pentru \"314CB\" și \"315CB\", nu setați direct \"CB\".",
"infoPassword": "Aceasta trebuie să conțină majuscule, minuscule și cel puțin un număr sau un simbol, având minimum 8 caractere.",
"infoAppIsOpenSource": "ACS UPB Mobile este open source.",

"stringEmailDomain": "@stud.acs.upb.ro",
"stringAnonymous": "Anonim",
Expand Down
12 changes: 2 additions & 10 deletions lib/pages/classes/view/class_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:acs_upb_mobile/pages/classes/service/class_provider.dart';
import 'package:acs_upb_mobile/pages/classes/view/grading_view.dart';
import 'package:acs_upb_mobile/pages/classes/view/shortcut_view.dart';
import 'package:acs_upb_mobile/resources/custom_icons.dart';
import 'package:acs_upb_mobile/resources/utils.dart';
import 'package:acs_upb_mobile/widgets/button.dart';
import 'package:acs_upb_mobile/widgets/dialog.dart';
import 'package:acs_upb_mobile/widgets/scaffold.dart';
Expand All @@ -13,7 +14,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:positioned_tap_detector/positioned_tap_detector.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';

extension ClassExtension on ClassHeader {
Color get colorFromAcronym {
Expand Down Expand Up @@ -164,14 +164,6 @@ class _ClassViewState extends State<ClassView> {
}
}

_launchURL(String url, BuildContext context) async {
if (await canLaunch(url)) {
await launch(url);
} else {
AppToast.show(S.of(context).errorCouldNotLaunchURL(url));
}
}

AppDialog _deletionConfirmationDialog(
{BuildContext context, String shortcutName, Function onDelete}) =>
AppDialog(
Expand All @@ -193,7 +185,7 @@ class _ClassViewState extends State<ClassView> {
var classViewContext = context;

return PositionedTapDetector(
onTap: (_) => _launchURL(shortcut.link, context),
onTap: (_) => Utils.launchURL(shortcut.link, context: context),
onLongPress: (position) async {
final RenderBox overlay =
Overlay.of(context).context.findRenderObject();
Expand Down
Loading

0 comments on commit f6054e0

Please sign in to comment.