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

Redesign/course unit #1407

Draft
wants to merge 109 commits into
base: ui/redesign
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
bd57543
September 2024 Release (#1321)
limwa Sep 13, 2024
70f4980
Bump app version [no ci]
limwa Sep 13, 2024
f560739
Merge branch 'master' into release/v1.9.1
limwa Sep 17, 2024
4efa3bb
release: v1.9.1 (#1330)
limwa Sep 18, 2024
ddae50e
Bump app version [no ci]
limwa Sep 18, 2024
8bedc62
Merge branch 'master' into release/v1.9.2
limwa Sep 23, 2024
0e4a08f
release: v1.9.2 (#1336)
DGoiana Sep 25, 2024
1785d0a
Bump app version [no ci]
DGoiana Sep 25, 2024
8a2b558
Merge branch 'master' into release/v1.9.3
DGoiana Sep 27, 2024
3c04ebc
Release/v1.9.3 (#1340)
DGoiana Sep 29, 2024
a408de1
Bump app version [no ci]
DGoiana Sep 29, 2024
e2eb66e
Merge branch 'master' into fix/v1.9.4
DGoiana Oct 6, 2024
6b7d2ee
Release v1.9.4 (#1349)
DGoiana Oct 6, 2024
7a51b5b
Bump app version [no ci]
DGoiana Oct 6, 2024
5045832
Merge branch 'master' into feature/v1.9.5
DGoiana Oct 10, 2024
cf96484
Release v1.9.5 (#1354)
DGoiana Oct 11, 2024
155d114
Bump app version [no ci]
DGoiana Oct 11, 2024
c049396
fix: logout when OpenID service is unavailable
limwa Oct 15, 2024
dfecd7c
fixing casts
DGoiana Oct 14, 2024
26d02b4
Merge branch 'develop' into fix/automatic-logout-on-openid-failure
DGoiana Oct 15, 2024
5a19e13
release: v1.9.6 (#1363)
thePeras Oct 16, 2024
549a43e
Bump app version [no ci]
thePeras Oct 16, 2024
8a2ca5a
Schedule page initializes on next lecture day
athoscf Oct 29, 2024
4460dfc
fix: Added Controllers Dispose methods
Pinho13 Nov 5, 2024
0c090f3
added icons to TabBar
simaopsbarbosa Nov 8, 2024
5e21fe6
added icons to TabBar
simaopsbarbosa Nov 8, 2024
94b5d53
Merge branch 'redesign/course-unit' of github.com:NIAEFEUP/uni into r…
simaopsbarbosa Nov 8, 2024
8765eae
changed TabIcon to look more similar to mockups
simaopsbarbosa Nov 8, 2024
c020069
added Professor Info modal
simaopsbarbosa Nov 8, 2024
91dcba4
added placeholder on professor info modal
simaopsbarbosa Nov 10, 2024
df701d8
fix: Double super.initState and Disposed Timer
Pinho13 Nov 12, 2024
a816818
Merge branch 'develop' into fix/Controller-Dispose-method
Pinho13 Nov 12, 2024
4200e0c
Refactored lecturesThisWeek as state variable
athoscf Nov 14, 2024
b42728d
Removed testing code
athoscf Nov 14, 2024
62a9881
Update provider to fetch exams by course
Adriano-7 Nov 18, 2024
8005aa5
Changed tuples to records - unfinished
jcovaa Nov 19, 2024
bf7c438
correct version of the Future method
jcovaa Nov 19, 2024
0a7881e
Merge branch 'develop' into refactor/change-tuples-to-records
thePeras Nov 19, 2024
4be6dd4
Formatted files
jcovaa Nov 22, 2024
55523b2
Merge branch 'refactor/change-tuples-to-records' of github.com:NIAEFE…
jcovaa Nov 22, 2024
15cb14b
Finish Transitions
Belem17 Nov 25, 2024
fa0c047
Finish Transitions
Belem17 Nov 25, 2024
87c6cc3
Disposed Controllers in some common Widgets
Pinho13 Nov 26, 2024
0f9ce28
fix:Format
Pinho13 Nov 26, 2024
8e24cba
fix: Format x2
Pinho13 Nov 26, 2024
118c470
corrected
Belem17 Nov 26, 2024
7f2dc1b
Changed build.gradle to add the new suffix. Changed AndroidManifest.x…
pedroafmonteiro Nov 26, 2024
9e5a1d9
Merge branch 'develop' into fix/automatic-logout-on-openid-failure
limwa Nov 27, 2024
0ac33ad
Changed applicationIdSuffix to ".dev"
pedroafmonteiro Nov 27, 2024
8c5e78a
Changed debug app name to "uni (dev)"
pedroafmonteiro Nov 27, 2024
fc5a786
Diferentiate the release and debug versions of uni. (#1399)
pedroafmonteiro Nov 27, 2024
d785c54
Bump app version [no ci]
pedroafmonteiro Nov 27, 2024
ba4d3fb
Finish Transitions (#1397)
DGoiana Nov 27, 2024
37405ed
Bump app version [no ci]
DGoiana Nov 27, 2024
6c63ef0
Merge branch 'develop' into fix/automatic-logout-on-openid-failure
limwa Nov 28, 2024
a306e1c
fix: logout when OpenID service is unavailable (#1361)
DGoiana Nov 28, 2024
2d7697d
Bump app version [no ci]
DGoiana Nov 28, 2024
e904194
Merge branch 'develop' into fix/Controller-Dispose-method
DGoiana Nov 29, 2024
b330fc3
Merge branch 'develop' into refactor/change-tuples-to-records
DGoiana Nov 29, 2024
cb285d9
fix: Added Controllers Dispose methods (#1383)
DGoiana Nov 29, 2024
a7c88b7
Bump app version [no ci]
DGoiana Nov 29, 2024
9106510
refactor: use inheritance for endpoints
limwa Oct 15, 2024
06a30a2
fix: make login endpoint extend endpoint
limwa Nov 30, 2024
7295342
chore: add nix flake
limwa Nov 30, 2024
fba44f2
fix: app halting after installation
limwa Nov 30, 2024
6fd0a35
fix: disallow backups
limwa Nov 30, 2024
ae6f244
refactor: use inheritance for endpoints (#1362)
DGoiana Dec 3, 2024
3a5e2c8
Bump app version [no ci]
DGoiana Dec 3, 2024
c9cc95b
Merge branch 'develop' into refactor/change-tuples-to-records
DGoiana Dec 3, 2024
8343f04
fix: app halting after installation (#1403)
DGoiana Dec 3, 2024
1002364
Merge branch 'develop' into chore/add-nix-flake
limwa Dec 3, 2024
b5002b7
Bump app version [no ci]
DGoiana Dec 3, 2024
49244d2
chore: add nix flake (#1401)
limwa Dec 3, 2024
a5c5366
Bump app version [no ci]
limwa Dec 3, 2024
91b145c
Merge branch 'develop' into refactor/change-tuples-to-records
DGoiana Dec 3, 2024
97fe376
Changed tuples to records (#1395)
DGoiana Dec 4, 2024
52aaba8
Bump app version [no ci]
DGoiana Dec 4, 2024
428bcc4
Merge branch 'master' into redesign/course-unit-exams
Adriano-7 Dec 4, 2024
84b694e
Started displaying the exams on the course unit
Adriano-7 Dec 6, 2024
b0fe929
Merge branch 'redesign/course-unit-exams' into redesign/course-unit
Adriano-7 Dec 6, 2024
00f0fc2
Removed the SizedBox on the exams col
Adriano-7 Dec 6, 2024
b70f75b
chore: add envrc files
limwa Dec 9, 2024
27924e1
Removed unused import
athoscf Dec 9, 2024
5bb0b6c
Bump app version [no ci]
niaefeup-admin Dec 9, 2024
25b0dd1
Merge branch 'develop' into fix/schedule-card-redirect
DGoiana Dec 9, 2024
affe5e1
Merge branch 'develop' into redesign/course-unit
Adriano-7 Dec 9, 2024
e5e4b87
Merge branch 'develop' into chore/add-envrc
DGoiana Dec 10, 2024
f8e1580
chore: add envrc files (#1409)
DGoiana Dec 10, 2024
3067393
Bump app version [no ci]
DGoiana Dec 10, 2024
d63dcd0
Merge branch 'develop' into fix/schedule-card-redirect
DGoiana Dec 10, 2024
572e556
fix: Click on schedule card redirects to next lecture's day (#1373)
DGoiana Dec 11, 2024
5dcfab1
Bump app version [no ci]
DGoiana Dec 11, 2024
4dcacf4
serialization
Belem17 Dec 17, 2024
489611b
serialization of database
Belem17 Dec 17, 2024
3c9d093
database serialization (#1416)
Belem17 Dec 18, 2024
6c2279e
Bump app version [no ci]
Belem17 Dec 18, 2024
40e323b
Merge branch 'develop' into redesign/course-unit
Adriano-7 Dec 26, 2024
8a0d8fb
Implemented exams row in course unit information
Adriano-7 Dec 27, 2024
bc4a2f8
Fixed bug causing books to be cropped on the course unit page
Adriano-7 Dec 27, 2024
0789f7b
Added date info to the exams widget
Adriano-7 Dec 27, 2024
cc9b5f8
Changed the format to pass the linter test
Adriano-7 Dec 27, 2024
4b0c272
Merge branch 'ui/redesign' into redesign/course-unit
Adriano-7 Dec 27, 2024
8ff66e7
Updated the way we use the icons
Adriano-7 Dec 27, 2024
df17ed3
Started working on the new professors widget
Adriano-7 Dec 28, 2024
ca22403
Started the logic of expanded/collapsed instructors
Adriano-7 Dec 28, 2024
32bb719
Extracted some logic from buildIntructorsRow
Adriano-7 Dec 28, 2024
7ae22ab
Handle books with empty ISBN
Adriano-7 Dec 28, 2024
a9f3d4e
Added Eligibility for exams section to course unit
Adriano-7 Dec 28, 2024
973bcd9
Add information indicating whether the professor is a regent
Adriano-7 Dec 28, 2024
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
27 changes: 27 additions & 0 deletions flake.lock

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

44 changes: 44 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
description = "A very basic flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};

outputs = { self, nixpkgs }:
let
system = "x86_64-linux";

pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};

androidComposition = pkgs.androidenv.composeAndroidPackages {
platformVersions = [ "31" "33" "34" ];
buildToolsVersions = [ "34.0.0" ];
includeNDK = true;
includeEmulator = true;
includeSystemImages = true;
};

androidSdk = androidComposition.androidsdk;
in {

devShell.${system} = pkgs.mkShell {
packages = with pkgs; [
flutter
jdk17
androidSdk
];

shellHook = ''
export ANDROID_HOME="${androidSdk}/libexec/android-sdk"
export JAVA_HOME="${pkgs.jdk17}"
'';
};
};
}
1 change: 1 addition & 0 deletions packages/uni_app/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake ../..
3 changes: 3 additions & 0 deletions packages/uni_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ android {
"proguard-rules.pro"
)
}
debug {
applicationIdSuffix ".dev"
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/uni_app/android/app/src/debug/res/values/string.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">uni (dev)</string>
</resources>
8 changes: 5 additions & 3 deletions packages/uni_app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application
android:label="uni"
<application
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
android:allowBackup="false"
>
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
4 changes: 4 additions & 0 deletions packages/uni_app/android/app/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">uni</string>
</resources>
2 changes: 1 addition & 1 deletion packages/uni_app/app_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0-beta.36+339
1.10.0-beta.48+352
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'package:logger/logger.dart';
import 'package:tuple/tuple.dart';
import 'package:uni/controller/background_workers/notifications.dart';
import 'package:workmanager/workmanager.dart';

/// This map contains the functions that a certain task type will run.
/// the bool is all functions that are ran by backgroundfetch in iOS
/// (they must not take any arguments, not checked)
const taskMap = {
'pt.up.fe.ni.uni.notificationworker':
Tuple2(NotificationManager.updateAndTriggerNotifications, true),
'pt.up.fe.ni.uni.notificationworker': (
NotificationManager.updateAndTriggerNotifications,
true
),
};

@pragma('vm:entry-point')
Expand All @@ -25,16 +26,16 @@ Future<void> workerStartCallback() async {
// by the iOS scheduler.
if (taskName == Workmanager.iOSBackgroundTask) {
taskMap.forEach((key, value) async {
if (value.item2) {
if (value.$2) {
Logger().d('''[$key]: Start executing job...''');
await value.item1();
await value.$1();
}
});
return true;
}
// try to keep the usage of this function BELOW +-30 seconds
// to not be punished by the scheduler in future runs.
await taskMap[taskName]!.item1();
await taskMap[taskName]!.$1();
} catch (err, st) {
Logger().e(
'Error while running $taskName job:',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tuple/tuple.dart';
import 'package:uni/controller/background_workers/notifications/tuition_notification.dart';
import 'package:uni/controller/local_storage/notification_timeout_storage.dart';
import 'package:uni/controller/local_storage/preferences_controller.dart';
Expand All @@ -28,12 +27,12 @@ abstract class Notification {
String uniqueID;
Duration timeout;

Future<Tuple2<String, String>> buildNotificationContent(Session session);
Future<(String, String)> buildNotificationContent(Session session);

Future<bool> shouldDisplay(Session session);

void displayNotification(
Tuple2<String, String> content,
(String, String) content,
FlutterLocalNotificationsPlugin localNotificationsPlugin,
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:tuple/tuple.dart';
import 'package:uni/controller/background_workers/notifications.dart';
import 'package:uni/controller/fetchers/fees_fetcher.dart';
import 'package:uni/controller/local_storage/preferences_controller.dart';
Expand All @@ -13,20 +12,20 @@ class TuitionNotification extends Notification {
late DateTime _dueDate;

@override
Future<Tuple2<String, String>> buildNotificationContent(
Future<(String, String)> buildNotificationContent(
Session session,
) async {
// We must add one day because the time limit is actually at 23:59 and
// not at 00:00 of the same day
if (_dueDate.add(const Duration(days: 1)).isBefore(DateTime.now())) {
final duration = DateTime.now().difference(_dueDate);
if (duration.inDays == 0) {
return const Tuple2(
return const (
'⚠️ Ainda não pagaste as propinas ⚠️',
'O prazo para pagar as propinas acabou ontem',
);
}
return Tuple2(
return (
'⚠️ Ainda não pagaste as propinas ⚠️',
duration.toFormattedString(
'Já passou {} desde a data limite',
Expand All @@ -36,12 +35,12 @@ class TuitionNotification extends Notification {
}
final duration = _dueDate.difference(DateTime.now());
if (duration.inDays == 0) {
return const Tuple2(
return const (
'O prazo limite para as propinas está a acabar',
'Hoje acaba o prazo para pagamento das propinas!',
);
}
return Tuple2(
return (
'O prazo limite para as propinas está a acabar',
duration.toFormattedString(
'Falta {} para a data limite',
Expand Down Expand Up @@ -72,7 +71,7 @@ class TuitionNotification extends Notification {

@override
void displayNotification(
Tuple2<String, String> content,
(String, String) content,
FlutterLocalNotificationsPlugin localNotificationsPlugin,
) {
const androidNotificationDetails = AndroidNotificationDetails(
Expand All @@ -95,8 +94,8 @@ class TuitionNotification extends Notification {

localNotificationsPlugin.show(
2,
content.item1,
content.item2,
content.$1,
content.$2,
notificationDetails,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:http/http.dart' as http;
import 'package:http/http.dart';
import 'package:tuple/tuple.dart';
import 'package:uni/model/entities/library_occupation.dart';

/// Fetch the library occupation from Google Sheets
class LibraryOccupationFetcher {
String baseUrl = 'https://webapi.affluences.com/api/fillRate?';

static const List<Tuple2<String, int>> floorMaxSeats = [
Tuple2('BruV6IlujdwAe1', 72),
Tuple2('cEhyzJZvC5nHSr', 114),
Tuple2('iceVfgwZWaZRhV', 114),
Tuple2('1yLPz9X0CNsg27', 114),
Tuple2('keu1j5zERlQn90', 40),
Tuple2('bY7K1v43HiAq55', 90),
static const List<(String, int)> floorMaxSeats = [
('BruV6IlujdwAe1', 72),
('cEhyzJZvC5nHSr', 114),
('iceVfgwZWaZRhV', 114),
('1yLPz9X0CNsg27', 114),
('keu1j5zERlQn90', 40),
('bY7K1v43HiAq55', 90),
];

Future<LibraryOccupation> getLibraryOccupation() async {
Expand All @@ -26,14 +25,13 @@ class LibraryOccupationFetcher {
floorMaxSeats.mapIndexed((i, entry) async {
final url = Uri.parse(baseUrl).replace(
queryParameters: {
'token': entry.item1,
'token': entry.$1,
},
);

final response = await http.get(url);

final floorOccupation =
processFloorOccupation(response, entry.item2, i);
final floorOccupation = processFloorOccupation(response, entry.$2, i);

libraryOccupation.addFloor(floorOccupation);
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class CalendarDatabase extends AppDatabase<List<CalendarEvent>> {
final List<Map<String, dynamic>> maps = await db.query('calendar');

return List.generate(maps.length, (i) {
return CalendarEvent(
maps[i]['name'] as String,
maps[i]['date'] as String,
);
return CalendarEvent.fromJson(maps[i]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,7 @@ class AppCourseUnitsDatabase extends AppDatabase<List<CourseUnit>> {
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?,
code: maps[i]['ucurr_codigo'] as String,
abbreviation: maps[i]['ucurr_sigla'] as String,
name: maps[i]['ucurr_nome'] as String,
curricularYear: maps[i]['ano'] as int?,
occurrId: maps[i]['ocorr_id'] as int,
semesterCode: maps[i]['per_codigo'] as String?,
semesterName: maps[i]['per_nome'] as String?,
type: maps[i]['tipo'] as String?,
status: maps[i]['estado'] as String?,
grade: maps[i]['resultado_melhor'] as String?,
ectsGrade: maps[i]['ectsGrade'] as String?,
result: maps[i]['resultado_insc'] as String?,
ects: maps[i]['creditos_ects'] as double?,
schoolYear: maps[i]['schoolYear'] as String?,
);
return CourseUnit.fromJson(maps[i]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,7 @@ class AppCoursesDatabase extends AppDatabase<List<Course>> {

// Convert the List<Map<String, dynamic> into a List<Course>.
return List.generate(maps.length, (i) {
return Course(
id: maps[i]['cur_id'] as int? ?? 0,
festId: maps[i]['fest_id'] as int? ?? 0,
name: maps[i]['cur_nome'] as String?,
abbreviation: maps[i]['abbreviation'] as String?,
currYear: maps[i]['ano_curricular'] as String?,
firstEnrollment: maps[i]['fest_a_lect_1_insc'] as int? ?? 0,
state: maps[i]['state'] as String?,
faculty: maps[i]['inst_sigla'] as String?,
finishedEcts: maps[i]['finishedEcts'] as double? ?? 0,
currentAverage: maps[i]['currentAverage'] as double? ?? 0,
);
return Course.fromJson(maps[i]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ CREATE TABLE lectures(subject TEXT, typeClass TEXT,
final List<Map<String, dynamic>> maps = await db.query('lectures');

return List.generate(maps.length, (i) {
return Lecture(
maps[i]['subject'] as String,
maps[i]['typeClass'] as String,
DateTime.parse(maps[i]['startTime'] as String),
DateTime.parse(maps[i]['endTime'] as String),
maps[i]['room'] as String,
maps[i]['teacher'] as String,
maps[i]['classNumber'] as String,
maps[i]['occurrId'] as int,
);
return Lecture.fromJson(maps[i]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ class LibraryOccupationDatabase extends AppDatabase<LibraryOccupation> {

for (var i = 0; i < maps.length; i++) {
occupation.addFloor(
FloorOccupation(
maps[i]['number'] as int,
maps[i]['occupation'] as int,
maps[i]['capacity'] as int,
),
FloorOccupation.fromJson(maps[i]),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ class AppReferencesDatabase extends AppDatabase<List<Reference>> {
final List<Map<String, dynamic>> maps = await db.query('refs');

return List.generate(maps.length, (i) {
return Reference(
maps[i]['description'] as String,
DateTime.parse(maps[i]['limitDate'] as String),
maps[i]['entity'] as int,
maps[i]['reference'] as int,
maps[i]['amount'] as double,
);
return Reference.fromJson(maps[i]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AppUserDataDatabase extends AppDatabase<Profile> {
for (final keymap in data.keymapValues()) {
await insertInDatabase(
'userdata',
{'name': keymap.item1, 'value': keymap.item2},
{'name': keymap.$1, 'value': keymap.$2},
);
}
}
Expand Down
Loading
Loading