From f1a93e9ee694286adde81a77eb3ecab409edd9d6 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Tue, 26 Sep 2023 16:33:54 +0100 Subject: [PATCH 1/8] Fixing day title translation --- uni/lib/generated/intl/messages_en.dart | 1 + uni/lib/generated/intl/messages_pt_PT.dart | 1 + uni/lib/generated/l10n.dart | 10 ++++++++++ uni/lib/l10n/intl_en.arb | 2 ++ uni/lib/l10n/intl_pt_PT.arb | 2 ++ uni/lib/view/exams/widgets/day_title.dart | 3 ++- 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/uni/lib/generated/intl/messages_en.dart b/uni/lib/generated/intl/messages_en.dart index 7c9d65e6c..6b46a9a56 100644 --- a/uni/lib/generated/intl/messages_en.dart +++ b/uni/lib/generated/intl/messages_en.dart @@ -112,6 +112,7 @@ class MessageLookup extends MessageLookupByLibrary { "edit_on": MessageLookupByLibrary.simpleMessage("Finish editing"), "empty_text": MessageLookupByLibrary.simpleMessage("Please fill in this field"), + "exam_of": MessageLookupByLibrary.simpleMessage("of"), "exams_filter": MessageLookupByLibrary.simpleMessage("Exams Filter Settings"), "exit_confirm": diff --git a/uni/lib/generated/intl/messages_pt_PT.dart b/uni/lib/generated/intl/messages_pt_PT.dart index c86c90267..a8a3ab3bf 100644 --- a/uni/lib/generated/intl/messages_pt_PT.dart +++ b/uni/lib/generated/intl/messages_pt_PT.dart @@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary { "edit_on": MessageLookupByLibrary.simpleMessage("Concluir edição"), "empty_text": MessageLookupByLibrary.simpleMessage( "Por favor preenche este campo"), + "exam_of": MessageLookupByLibrary.simpleMessage("de"), "exams_filter": MessageLookupByLibrary.simpleMessage("Definições Filtro de Exames"), "exit_confirm": MessageLookupByLibrary.simpleMessage( diff --git a/uni/lib/generated/l10n.dart b/uni/lib/generated/l10n.dart index 804bd1400..ef1a35f26 100644 --- a/uni/lib/generated/l10n.dart +++ b/uni/lib/generated/l10n.dart @@ -1028,6 +1028,16 @@ class S { ); } + /// `of` + String get exam_of { + return Intl.message( + 'of', + name: 'exam_of', + desc: '', + args: [], + ); + } + /// `Other links` String get other_links { return Intl.message( diff --git a/uni/lib/l10n/intl_en.arb b/uni/lib/l10n/intl_en.arb index acc5d7b7c..e8fec3e09 100644 --- a/uni/lib/l10n/intl_en.arb +++ b/uni/lib/l10n/intl_en.arb @@ -200,6 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Type of occurrence", "@occurrence_type": {}, + "exam_of": "of", + "@exam_of": {}, "other_links": "Other links", "@other_links": {}, "pass_change_request": "For security reasons, passwords must be changed periodically.", diff --git a/uni/lib/l10n/intl_pt_PT.arb b/uni/lib/l10n/intl_pt_PT.arb index 7552ae5c3..b9a9d0bca 100644 --- a/uni/lib/l10n/intl_pt_PT.arb +++ b/uni/lib/l10n/intl_pt_PT.arb @@ -200,6 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Tipo de ocorrência", "@occurrence_type": {}, + "exam_of": "de", + "@exam_of": {}, "other_links": "Outros links", "@other_links": {}, "pass_change_request": "Por razões de segurança, as palavras-passe têm de ser alteradas periodicamente.", diff --git a/uni/lib/view/exams/widgets/day_title.dart b/uni/lib/view/exams/widgets/day_title.dart index 56710245a..f42528a03 100644 --- a/uni/lib/view/exams/widgets/day_title.dart +++ b/uni/lib/view/exams/widgets/day_title.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:uni/generated/l10n.dart'; class DayTitle extends StatelessWidget { const DayTitle({ @@ -17,7 +18,7 @@ class DayTitle extends StatelessWidget { padding: const EdgeInsets.only(top: 15, bottom: 3), alignment: Alignment.center, child: Text( - '$weekDay, $day de $month', + '$weekDay, $day ${S.of(context).exam_of} $month', style: Theme.of(context).textTheme.titleLarge, ), ); From 43a8106ad76ac13f3f888825b1cb08ee303741de Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 4 Oct 2023 14:10:06 +0100 Subject: [PATCH 2/8] of_month --- uni/lib/generated/intl/messages_pt_PT.dart | 2 +- uni/lib/generated/l10n.dart | 4 ++-- uni/lib/l10n/intl_en.arb | 4 ++-- uni/lib/l10n/intl_pt_PT.arb | 4 ++-- uni/lib/view/exams/widgets/day_title.dart | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/uni/lib/generated/intl/messages_pt_PT.dart b/uni/lib/generated/intl/messages_pt_PT.dart index a8a3ab3bf..f023e098b 100644 --- a/uni/lib/generated/intl/messages_pt_PT.dart +++ b/uni/lib/generated/intl/messages_pt_PT.dart @@ -111,7 +111,7 @@ class MessageLookup extends MessageLookupByLibrary { "edit_on": MessageLookupByLibrary.simpleMessage("Concluir edição"), "empty_text": MessageLookupByLibrary.simpleMessage( "Por favor preenche este campo"), - "exam_of": MessageLookupByLibrary.simpleMessage("de"), + "of_month": MessageLookupByLibrary.simpleMessage("de"), "exams_filter": MessageLookupByLibrary.simpleMessage("Definições Filtro de Exames"), "exit_confirm": MessageLookupByLibrary.simpleMessage( diff --git a/uni/lib/generated/l10n.dart b/uni/lib/generated/l10n.dart index ef1a35f26..c8fc61c27 100644 --- a/uni/lib/generated/l10n.dart +++ b/uni/lib/generated/l10n.dart @@ -1029,10 +1029,10 @@ class S { } /// `of` - String get exam_of { + String get of_month { return Intl.message( 'of', - name: 'exam_of', + name: 'of_month', desc: '', args: [], ); diff --git a/uni/lib/l10n/intl_en.arb b/uni/lib/l10n/intl_en.arb index e8fec3e09..d1dcadff2 100644 --- a/uni/lib/l10n/intl_en.arb +++ b/uni/lib/l10n/intl_en.arb @@ -200,8 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Type of occurrence", "@occurrence_type": {}, - "exam_of": "of", - "@exam_of": {}, + "of_month": "of", + "@of_month": {}, "other_links": "Other links", "@other_links": {}, "pass_change_request": "For security reasons, passwords must be changed periodically.", diff --git a/uni/lib/l10n/intl_pt_PT.arb b/uni/lib/l10n/intl_pt_PT.arb index b9a9d0bca..145d3bbfd 100644 --- a/uni/lib/l10n/intl_pt_PT.arb +++ b/uni/lib/l10n/intl_pt_PT.arb @@ -200,8 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Tipo de ocorrência", "@occurrence_type": {}, - "exam_of": "de", - "@exam_of": {}, + "of_month": "de", + "@of_month": {}, "other_links": "Outros links", "@other_links": {}, "pass_change_request": "Por razões de segurança, as palavras-passe têm de ser alteradas periodicamente.", diff --git a/uni/lib/view/exams/widgets/day_title.dart b/uni/lib/view/exams/widgets/day_title.dart index f42528a03..b0626a86b 100644 --- a/uni/lib/view/exams/widgets/day_title.dart +++ b/uni/lib/view/exams/widgets/day_title.dart @@ -18,7 +18,7 @@ class DayTitle extends StatelessWidget { padding: const EdgeInsets.only(top: 15, bottom: 3), alignment: Alignment.center, child: Text( - '$weekDay, $day ${S.of(context).exam_of} $month', + '$weekDay, $day ${S.of(context).of_month} $month', style: Theme.of(context).textTheme.titleLarge, ), ); From c470bd80fdbf957587f20c3288ab2ff103f219c4 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Fri, 6 Oct 2023 11:56:51 +0100 Subject: [PATCH 3/8] Unused months removal --- .../local_storage/app_exams_database.dart | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/uni/lib/controller/local_storage/app_exams_database.dart b/uni/lib/controller/local_storage/app_exams_database.dart index 36264e347..47dbb4e39 100644 --- a/uni/lib/controller/local_storage/app_exams_database.dart +++ b/uni/lib/controller/local_storage/app_exams_database.dart @@ -11,20 +11,6 @@ import 'package:uni/model/entities/exam.dart'; class AppExamsDatabase extends AppDatabase { AppExamsDatabase() : super('exams.db', [_createScript], onUpgrade: migrate, version: 5); - Map months = { - 'Janeiro': '01', - 'Fevereiro': '02', - 'Março': '03', - 'Abril': '04', - 'Maio': '05', - 'Junho': '06', - 'Julho': '07', - 'Agosto': '08', - 'Setembro': '09', - 'Outubro': '10', - 'Novembro': '11', - 'Dezembro': '12' - }; static const _createScript = ''' CREATE TABLE exams(id TEXT, subject TEXT, begin TEXT, end TEXT, From d436bcce066e5598d4bc0134a13bbcb74d6853bb Mon Sep 17 00:00:00 2001 From: LuisDuarte1 Date: Tue, 10 Oct 2023 09:20:11 +0000 Subject: [PATCH 4/8] Bump app version [no ci] --- uni/app_version.txt | 2 +- uni/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uni/app_version.txt b/uni/app_version.txt index 5659dbf3d..9d44229de 100644 --- a/uni/app_version.txt +++ b/uni/app_version.txt @@ -1 +1 @@ -1.7.15+205 \ No newline at end of file +1.7.16+206 \ No newline at end of file diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index a02b440b0..d4619d650 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: 'none' # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.7.15+205 +version: 1.7.16+206 environment: sdk: '>=3.0.0 <4.0.0' From 0b5ff94fdf51d63a9860f2309d3bb3ef8479a5e7 Mon Sep 17 00:00:00 2001 From: rubuy-74 Date: Fri, 6 Oct 2023 14:58:23 +0100 Subject: [PATCH 5/8] Encapsulate Url Launch with Toast --- .../controller/networking/url_launcher.dart | 18 ++++++++++++++++++ uni/lib/generated/intl/messages_en.dart | 2 ++ uni/lib/generated/intl/messages_pt_PT.dart | 2 ++ uni/lib/generated/l10n.dart | 10 ++++++++++ uni/lib/l10n/intl_en.arb | 2 ++ uni/lib/l10n/intl_pt_PT.arb | 2 ++ .../about/widgets/terms_and_conditions.dart | 12 +++++------- .../view/schedule/widgets/schedule_slot.dart | 8 ++++---- uni/lib/view/terms_and_condition_dialog.dart | 2 +- .../view/useful_info/widgets/link_button.dart | 4 ++-- .../useful_info/widgets/text_components.dart | 4 ++-- 11 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 uni/lib/controller/networking/url_launcher.dart diff --git a/uni/lib/controller/networking/url_launcher.dart b/uni/lib/controller/networking/url_launcher.dart new file mode 100644 index 000000000..f4ff85ae5 --- /dev/null +++ b/uni/lib/controller/networking/url_launcher.dart @@ -0,0 +1,18 @@ +import 'dart:async'; + +import 'package:flutter/cupertino.dart'; +import 'package:uni/generated/l10n.dart'; +import 'package:uni/view/common_widgets/toast_message.dart'; +import 'package:url_launcher/url_launcher.dart'; + +Future launchUrlWithToast(BuildContext context, String url) async { + final validUrl = Uri.parse(url); + if (url != '' && canLaunchUrl(validUrl) as bool) { + await launchUrl(Uri.parse(url)); + } else { + await ToastMessage.error( + context, + S.of(context).no_link, + ); + } +} diff --git a/uni/lib/generated/intl/messages_en.dart b/uni/lib/generated/intl/messages_en.dart index 112516f05..b1570e0e7 100644 --- a/uni/lib/generated/intl/messages_en.dart +++ b/uni/lib/generated/intl/messages_en.dart @@ -180,6 +180,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("No favorite restaurants"), "no_info": MessageLookupByLibrary.simpleMessage( "There is no information to display"), + "no_link": + MessageLookupByLibrary.simpleMessage("We couldn\'t open the link"), "no_menu_info": MessageLookupByLibrary.simpleMessage( "There is no information available about meals"), "no_menus": MessageLookupByLibrary.simpleMessage( diff --git a/uni/lib/generated/intl/messages_pt_PT.dart b/uni/lib/generated/intl/messages_pt_PT.dart index 68a173ffe..e09dafb26 100644 --- a/uni/lib/generated/intl/messages_pt_PT.dart +++ b/uni/lib/generated/intl/messages_pt_PT.dart @@ -181,6 +181,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Sem restaurantes favoritos"), "no_info": MessageLookupByLibrary.simpleMessage( "Não existem informações para apresentar"), + "no_link": MessageLookupByLibrary.simpleMessage( + "Não conseguimos abrir o link"), "no_menu_info": MessageLookupByLibrary.simpleMessage( "Não há informação disponível sobre refeições"), "no_menus": MessageLookupByLibrary.simpleMessage( diff --git a/uni/lib/generated/l10n.dart b/uni/lib/generated/l10n.dart index 936259b3e..584841336 100644 --- a/uni/lib/generated/l10n.dart +++ b/uni/lib/generated/l10n.dart @@ -1028,6 +1028,16 @@ class S { ); } + /// `We couldn't open the link` + String get no_link { + return Intl.message( + 'We couldn\'t open the link', + name: 'no_link', + desc: '', + args: [], + ); + } + /// `Other links` String get other_links { return Intl.message( diff --git a/uni/lib/l10n/intl_en.arb b/uni/lib/l10n/intl_en.arb index b1d6be897..ad759e52a 100644 --- a/uni/lib/l10n/intl_en.arb +++ b/uni/lib/l10n/intl_en.arb @@ -200,6 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Type of occurrence", "@occurrence_type": {}, + "no_link": "We couldn't open the link", + "@no_link": {}, "other_links": "Other links", "@other_links": {}, "pass_change_request": "For security reasons, passwords must be changed periodically.", diff --git a/uni/lib/l10n/intl_pt_PT.arb b/uni/lib/l10n/intl_pt_PT.arb index 4315ac0af..b6cb3b650 100644 --- a/uni/lib/l10n/intl_pt_PT.arb +++ b/uni/lib/l10n/intl_pt_PT.arb @@ -200,6 +200,8 @@ "@no_selected_exams": {}, "occurrence_type": "Tipo de ocorrência", "@occurrence_type": {}, + "no_link": "Não conseguimos abrir o link", + "@no_link": {}, "other_links": "Outros links", "@other_links": {}, "pass_change_request": "Por razões de segurança, as palavras-passe têm de ser alteradas periodicamente.", diff --git a/uni/lib/view/about/widgets/terms_and_conditions.dart b/uni/lib/view/about/widgets/terms_and_conditions.dart index 1a53d07da..049872e2b 100644 --- a/uni/lib/view/about/widgets/terms_and_conditions.dart +++ b/uni/lib/view/about/widgets/terms_and_conditions.dart @@ -2,15 +2,15 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:uni/controller/load_static/terms_and_conditions.dart'; +import 'package:uni/controller/networking/url_launcher.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:url_launcher/url_launcher.dart'; class TermsAndConditions extends StatelessWidget { const TermsAndConditions({super.key}); @override Widget build(BuildContext context) { - var termsAndConditionsSaved = S.of(context).loading_terms; + String? termsAndConditionsSaved = S.of(context).loading_terms; final termsAndConditionsFuture = fetchTermsAndConditions(); return FutureBuilder( future: termsAndConditionsFuture, @@ -18,16 +18,14 @@ class TermsAndConditions extends StatelessWidget { (BuildContext context, AsyncSnapshot termsAndConditions) { if (termsAndConditions.connectionState == ConnectionState.done && termsAndConditions.hasData) { - termsAndConditionsSaved = termsAndConditions.data!; + termsAndConditionsSaved = termsAndConditions.data; } return MarkdownBody( styleSheet: MarkdownStyleSheet(), shrinkWrap: false, - data: termsAndConditionsSaved, + data: termsAndConditionsSaved!, onTapLink: (text, url, title) async { - if (await canLaunchUrl(Uri.parse(url!))) { - await launchUrl(Uri.parse(url)); - } + await launchUrlWithToast(context, url!); }, ); }, diff --git a/uni/lib/view/schedule/widgets/schedule_slot.dart b/uni/lib/view/schedule/widgets/schedule_slot.dart index d63957f02..86078a71f 100644 --- a/uni/lib/view/schedule/widgets/schedule_slot.dart +++ b/uni/lib/view/schedule/widgets/schedule_slot.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:uni/controller/networking/network_router.dart'; +import 'package:uni/controller/networking/url_launcher.dart'; import 'package:uni/view/common_widgets/row_container.dart'; -import 'package:url_launcher/url_launcher.dart'; class ScheduleSlot extends StatelessWidget { const ScheduleSlot({ @@ -113,9 +113,9 @@ class SubjectButtonWidget extends StatelessWidget { 'UCURR_GERAL.FICHA_UC_VIEW?pv_ocorrencia_id=$occurrId'; } - Future _launchURL() async { + Future _launchURL(BuildContext context) async { final url = toUcLink(occurrId); - await launchUrl(Uri.parse(url)); + await launchUrlWithToast(context, url); } @override @@ -133,7 +133,7 @@ class SubjectButtonWidget extends StatelessWidget { color: Colors.grey, alignment: Alignment.centerRight, tooltip: 'Abrir página da UC no browser', - onPressed: _launchURL, + onPressed: () => _launchURL(context), ), ], ); diff --git a/uni/lib/view/terms_and_condition_dialog.dart b/uni/lib/view/terms_and_condition_dialog.dart index 245cd0747..5f4027ea0 100644 --- a/uni/lib/view/terms_and_condition_dialog.dart +++ b/uni/lib/view/terms_and_condition_dialog.dart @@ -80,7 +80,7 @@ class TermsAndConditionDialog { ), ), ], - ) + ), ], ), ); diff --git a/uni/lib/view/useful_info/widgets/link_button.dart b/uni/lib/view/useful_info/widgets/link_button.dart index 3dc240d3c..032a90c34 100644 --- a/uni/lib/view/useful_info/widgets/link_button.dart +++ b/uni/lib/view/useful_info/widgets/link_button.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:uni/controller/networking/url_launcher.dart'; class LinkButton extends StatelessWidget { const LinkButton({ @@ -27,7 +27,7 @@ class LinkButton extends StatelessWidget { .headlineSmall! .copyWith(decoration: TextDecoration.underline), ), - onTap: () => launchUrl(Uri.parse(link)), + onTap: () => launchUrlWithToast(context, link), ), ) ], diff --git a/uni/lib/view/useful_info/widgets/text_components.dart b/uni/lib/view/useful_info/widgets/text_components.dart index 345685277..7ef70043e 100644 --- a/uni/lib/view/useful_info/widgets/text_components.dart +++ b/uni/lib/view/useful_info/widgets/text_components.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:uni/controller/networking/url_launcher.dart'; Container h1(String text, BuildContext context, {bool initial = false}) { final marginTop = initial ? 15.0 : 30.0; @@ -44,7 +44,7 @@ Container infoText( .bodyLarge! .apply(color: Theme.of(context).colorScheme.tertiary), ), - onTap: () => link != '' ? launchUrl(Uri.parse(link)) : null, + onTap: () => launchUrlWithToast(context, link), ), ), ); From 1758e7c056a20f0f4e3498b1bfa1d750405ca280 Mon Sep 17 00:00:00 2001 From: bdmendes Date: Wed, 11 Oct 2023 11:08:35 +0000 Subject: [PATCH 6/8] Bump app version [no ci] --- uni/app_version.txt | 2 +- uni/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uni/app_version.txt b/uni/app_version.txt index 9d44229de..30f41288c 100644 --- a/uni/app_version.txt +++ b/uni/app_version.txt @@ -1 +1 @@ -1.7.16+206 \ No newline at end of file +1.7.17+207 \ No newline at end of file diff --git a/uni/pubspec.yaml b/uni/pubspec.yaml index d4619d650..8a66599d1 100644 --- a/uni/pubspec.yaml +++ b/uni/pubspec.yaml @@ -7,7 +7,7 @@ publish_to: 'none' # We do not publish to pub.dev # To change it manually, override the value in app_version.txt. # The app version code is automatically also bumped by CI. # Do not change it manually. -version: 1.7.16+206 +version: 1.7.17+207 environment: sdk: '>=3.0.0 <4.0.0' From 0863b86bdc1caa6a26e41a02a23353c618617289 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Wed, 11 Oct 2023 14:47:12 +0100 Subject: [PATCH 7/8] format fix --- uni/lib/generated/l10n.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uni/lib/generated/l10n.dart b/uni/lib/generated/l10n.dart index 7165da849..107ad3a6f 100644 --- a/uni/lib/generated/l10n.dart +++ b/uni/lib/generated/l10n.dart @@ -1037,7 +1037,7 @@ class S { args: [], ); } - + /// `We couldn't open the link` String get no_link { return Intl.message( From 8c7d071062621bd75f43241a5d07019b9436ad27 Mon Sep 17 00:00:00 2001 From: DGoiana Date: Thu, 4 Jan 2024 17:43:06 +0000 Subject: [PATCH 8/8] Fixing app version --- uni/app_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uni/app_version.txt b/uni/app_version.txt index ac0c32f7b..c85024bed 100644 --- a/uni/app_version.txt +++ b/uni/app_version.txt @@ -1 +1 @@ -1.7.30+220 +1.7.30+220 \ No newline at end of file