Skip to content

Commit

Permalink
release: v1.9.1 (#1330)
Browse files Browse the repository at this point in the history
  • Loading branch information
limwa authored Sep 18, 2024
2 parents 70f4980 + f560739 commit 4efa3bb
Show file tree
Hide file tree
Showing 19 changed files with 120 additions and 226 deletions.
2 changes: 1 addition & 1 deletion packages/uni_app/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/uni_app/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
end
2 changes: 1 addition & 1 deletion packages/uni_app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
378A17102ACF02E100B89C1C = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:uni/controller/fetchers/session_dependant_fetcher.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/entities/profile.dart';
import 'package:uni/model/utils/time/week.dart';
import 'package:uni/session/flows/base/session.dart';

/// Class for fetching the user's schedule.
abstract class ScheduleFetcher extends SessionDependantFetcher {
// Returns the user's lectures.
Future<List<Lecture>> getLectures(Session session, Profile profile);
Future<List<Lecture>> getLectures(Session session);

List<Week> getWeeks(DateTime now) {
final week = Week(start: now);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher.dart';
import 'package:uni/controller/networking/network_router.dart';
import 'package:uni/controller/parsers/schedule/api/parser.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/entities/profile.dart';
import 'package:uni/model/utils/time/week.dart';
import 'package:uni/session/flows/base/session.dart';

Expand All @@ -19,7 +18,7 @@ class ScheduleFetcherApi extends ScheduleFetcher {

/// Fetches the user's lectures from the faculties' API.
@override
Future<List<Lecture>> getLectures(Session session, Profile profile) async {
Future<List<Lecture>> getLectures(Session session) async {
final dates = getDates();

final urls = getEndpoints(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher.dart';
import 'package:uni/controller/networking/network_router.dart';
import 'package:uni/controller/parsers/schedule/new_api/parser.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/entities/profile.dart';
import 'package:uni/session/flows/base/session.dart';

/// Class for fetching the user's lectures from the schedule's HTML page.
Expand All @@ -17,7 +16,7 @@ class ScheduleFetcherNewApi extends ScheduleFetcher {

/// Fetches the user's lectures from the schedule's HTML page.
@override
Future<List<Lecture>> getLectures(Session session, Profile profile) async {
Future<List<Lecture>> getLectures(Session session) async {
final endpoints = getEndpoints(session);
final lectiveYear = getLectiveYear(DateTime.now());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ class AppCourseUnitsDatabase extends AppDatabase<List<CourseUnit>> {
: super(
'course_units.db',
[createScript],
onUpgrade: migrate,
version: 2,
);
static const String createScript =
'''CREATE TABLE course_units(ucurr_id INTEGER, ucurr_codigo TEXT, ucurr_sigla TEXT , '''
'''ucurr_nome TEXT, ano INTEGER, ocorr_id INTEGER, per_codigo TEXT, '''
'''per_nome TEXT, tipo TEXT, estado TEXT, resultado_melhor TEXT, resultado_ects TEXT, '''
'''resultado_insc TEXT, creditos_ects REAL, schoolYear TEXT)''';
'''ectsGrade TEXT, resultado_insc TEXT, creditos_ects REAL, schoolYear TEXT)''';

Future<List<CourseUnit>> courseUnits() async {
final db = await getDatabase();
final List<Map<String, dynamic>> maps = await db.query('course_units');
return List.generate(maps.length, (i) {
return CourseUnit(
id: maps[i]['ucurr_id'] as int,
id: maps[i]['ucurr_id'] as int?,
code: maps[i]['ucurr_codigo'] as String,
abbreviation: maps[i]['ucurr_sigla'] as String,
name: maps[i]['ucurr_nome'] as String,
Expand Down Expand Up @@ -55,6 +57,17 @@ class AppCourseUnitsDatabase extends AppDatabase<List<CourseUnit>> {
await db.delete('course_units');
}

static FutureOr<void> migrate(
Database db,
int oldVersion,
int newVersion,
) async {
final batch = db.batch()
..execute('DROP TABLE IF EXISTS course_units')
..execute(createScript);
await batch.commit();
}

@override
Future<void> saveToDatabase(List<CourseUnit> data) async {
await deleteCourseUnits();
Expand Down
3 changes: 3 additions & 0 deletions packages/uni_app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class MessageLookup extends MessageLookupByLibrary {
"balance": MessageLookupByLibrary.simpleMessage("Balance:"),
"banner_info": MessageLookupByLibrary.simpleMessage(
"We do now collect anonymous usage statistics in order to improve your experience. You can change it in settings."),
"bibliography": MessageLookupByLibrary.simpleMessage("Bibliography"),
"bs_description": MessageLookupByLibrary.simpleMessage(
"Did you find any bugs in the application?\nDo you have any suggestions for the app?\nTell us so we can improve!"),
"bug_description": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -120,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"edit_on": MessageLookupByLibrary.simpleMessage("Finish editing"),
"empty_text":
MessageLookupByLibrary.simpleMessage("Please fill in this field"),
"evaluation": MessageLookupByLibrary.simpleMessage("Evaluation"),
"exams_filter":
MessageLookupByLibrary.simpleMessage("Exams Filter Settings"),
"exit_confirm":
Expand Down Expand Up @@ -248,6 +250,7 @@ class MessageLookup extends MessageLookupByLibrary {
"prints": MessageLookupByLibrary.simpleMessage("Prints"),
"problem_id": MessageLookupByLibrary.simpleMessage(
"Brief identification of the problem"),
"program": MessageLookupByLibrary.simpleMessage("Program"),
"reference_sigarra_help": MessageLookupByLibrary.simpleMessage(
"The generated reference data will appear in Sigarra, checking account.\nProfile > Checking Account"),
"reference_success": MessageLookupByLibrary.simpleMessage(
Expand Down
3 changes: 3 additions & 0 deletions packages/uni_app/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class MessageLookup extends MessageLookupByLibrary {
"balance": MessageLookupByLibrary.simpleMessage("Saldo:"),
"banner_info": MessageLookupByLibrary.simpleMessage(
"Agora recolhemos estatísticas de uso anónimas para melhorar a tua experiência. Podes alterá-lo nas definições."),
"bibliography": MessageLookupByLibrary.simpleMessage("Bibliografia"),
"bs_description": MessageLookupByLibrary.simpleMessage(
"Encontraste algum bug na aplicação?\nTens alguma sugestão para a app?\nConta-nos para que possamos melhorar!"),
"bug_description": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -119,6 +120,7 @@ class MessageLookup extends MessageLookupByLibrary {
"edit_on": MessageLookupByLibrary.simpleMessage("Concluir edição"),
"empty_text": MessageLookupByLibrary.simpleMessage(
"Por favor preenche este campo"),
"evaluation": MessageLookupByLibrary.simpleMessage("Avaliação"),
"exams_filter":
MessageLookupByLibrary.simpleMessage("Definições Filtro de Exames"),
"exit_confirm": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -249,6 +251,7 @@ class MessageLookup extends MessageLookupByLibrary {
"prints": MessageLookupByLibrary.simpleMessage("Impressões"),
"problem_id": MessageLookupByLibrary.simpleMessage(
"Breve identificação do problema"),
"program": MessageLookupByLibrary.simpleMessage("Programa"),
"reference_sigarra_help": MessageLookupByLibrary.simpleMessage(
"Os dados da referência gerada aparecerão no Sigarra, conta corrente. Perfil > Conta Corrente"),
"reference_success": MessageLookupByLibrary.simpleMessage(
Expand Down
30 changes: 30 additions & 0 deletions packages/uni_app/lib/generated/l10n.dart

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

6 changes: 6 additions & 0 deletions packages/uni_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"@banner_info": {},
"balance": "Balance:",
"@balance": {},
"bibliography": "Bibliography",
"@bibliography": {},
"bs_description": "Did you find any bugs in the application?\nDo you have any suggestions for the app?\nTell us so we can improve!",
"@bs_description": {},
"bug_description": "Bug found, how to reproduce it, etc.",
Expand Down Expand Up @@ -106,6 +108,8 @@
"@edit_on": {},
"empty_text": "Please fill in this field",
"@empty_text": {},
"evaluation": "Evaluation",
"@evaluation": {},
"exams_filter": "Exams Filter Settings",
"@exams_filter": {},
"expired_password": "Your password has expired",
Expand Down Expand Up @@ -248,6 +252,8 @@
"@successful_open": {},
"permission_denied": "Permission denied",
"@permission_denied": {},
"program": "Program",
"@program": {},
"open_error": "Error opening the file",
"@open_error": {},
"no_app": "No app found to open the file",
Expand Down
6 changes: 6 additions & 0 deletions packages/uni_app/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"@banner_info": {},
"balance": "Saldo:",
"@balance": {},
"bibliography": "Bibliografia",
"@bibliography": {},
"bs_description": "Encontraste algum bug na aplicação?\nTens alguma sugestão para a app?\nConta-nos para que possamos melhorar!",
"@bs_description": {},
"bug_description": "Bug encontrado, como o reproduzir, etc",
Expand Down Expand Up @@ -108,6 +110,8 @@
"@edit_on": {},
"empty_text": "Por favor preenche este campo",
"@empty_text": {},
"evaluation": "Avaliação",
"@evaluation": {},
"exams_filter": "Definições Filtro de Exames",
"@exams_filter": {},
"expired_password": "A tua palavra-passe expirou",
Expand Down Expand Up @@ -252,6 +256,8 @@
"@personal_assistance": {},
"press_again": "Pressione novamente para sair",
"@press_again": {},
"program": "Programa",
"@program": {},
"print": "Impressão",
"@print": {},
"prints": "Impressões",
Expand Down
15 changes: 10 additions & 5 deletions packages/uni_app/lib/model/entities/course.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ part '../../generated/model/entities/course.g.dart';
@JsonSerializable(createFactory: false)
class Course {
Course({
required this.id,
this.id,
this.festId,
this.name,
this.abbreviation,
Expand All @@ -27,10 +27,15 @@ class Course {
});

factory Course.fromJson(Map<String, dynamic> json) {
var name = json['cur_nome'] as String?;
if (name == null || name.isEmpty) {
name = json['fest_tipo_descr'] as String?;
}

return Course(
id: json['cur_id'] as int,
id: json['cur_id'] as int?,
festId: json['fest_id'] as int?,
name: json['cur_nome'] as String?,
name: name,
abbreviation: json['abbreviation'] as String?,
currYear: json['ano_curricular'] as String?,
firstEnrollment: json['fest_a_lect_1_insc'] as int?,
Expand All @@ -41,8 +46,8 @@ class Course {
);
}
@JsonKey(name: 'cur_id')
final int id;
@JsonKey(name: 'fest_id ')
final int? id;
@JsonKey(name: 'fest_id')
final int? festId;
@JsonKey(name: 'cur_nome')
final String? name;
Expand Down
17 changes: 6 additions & 11 deletions packages/uni_app/lib/model/providers/lazy/lecture_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher_api.da
import 'package:uni/controller/fetchers/schedule_fetcher/schedule_fetcher_new_api.dart';
import 'package:uni/controller/local_storage/database/app_lectures_database.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/entities/profile.dart';
import 'package:uni/model/providers/state_provider_notifier.dart';
import 'package:uni/model/providers/state_providers.dart';
import 'package:uni/session/flows/base/session.dart';
Expand All @@ -23,17 +22,14 @@ class LectureProvider extends StateProviderNotifier<List<Lecture>> {
Future<List<Lecture>> loadFromRemote(StateProviders stateProviders) async {
return fetchUserLectures(
stateProviders.sessionProvider.state!,
stateProviders.profileProvider.state!,
);
}

Future<List<Lecture>> fetchUserLectures(
Session session,
Profile profile, {
Session session, {
ScheduleFetcher? fetcher,
}) async {
final lectures =
await getLecturesFromFetcherOrElse(fetcher, session, profile);
final lectures = await getLecturesFromFetcherOrElse(fetcher, session);

final db = AppLecturesDatabase();
await db.saveIfPersistentSession(lectures);
Expand All @@ -44,13 +40,12 @@ class LectureProvider extends StateProviderNotifier<List<Lecture>> {
Future<List<Lecture>> getLecturesFromFetcherOrElse(
ScheduleFetcher? fetcher,
Session session,
Profile profile,
) =>
fetcher?.getLectures(session, profile) ?? getLectures(session, profile);
fetcher?.getLectures(session) ?? getLectures(session);

Future<List<Lecture>> getLectures(Session session, Profile profile) {
return ScheduleFetcherApi().getLectures(session, profile).catchError(
(e) => ScheduleFetcherNewApi().getLectures(session, profile),
Future<List<Lecture>> getLectures(Session session) {
return ScheduleFetcherApi().getLectures(session).catchError(
(e) => ScheduleFetcherNewApi().getLectures(session),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ abstract class StateProviderNotifier<T> extends ChangeNotifier {
RequestStatus initialStatus = RequestStatus.busy,
T? initialState,
}) : _requestStatus = initialStatus,
_initialState = initialState,
_state = initialState;

/// The initial state of the model.
final T? _initialState;

/// The model that this notifier provides.
/// This future will throw if the data loading fails.
T? _state;
Expand Down Expand Up @@ -68,7 +72,7 @@ abstract class StateProviderNotifier<T> extends ChangeNotifier {
/// Makes the state null, as if the model has never been loaded,
/// so that consumers may trigger the loading again.
void invalidate() {
_state = null;
_state = _initialState;
notifyListeners();
}

Expand Down
Loading

0 comments on commit 4efa3bb

Please sign in to comment.