nickname changing

This commit is contained in:
55nknown 2022-11-15 09:00:38 +01:00
parent 82671f5ec9
commit f8cfa04d04
7 changed files with 14 additions and 4 deletions

View File

@ -15,6 +15,7 @@ class UserProvider with ChangeNotifier {
String? get password => user?.password; String? get password => user?.password;
Role? get role => user?.role; Role? get role => user?.role;
Student? get student => user?.student; Student? get student => user?.student;
String? get nickname => user?.nickname;
void setUser(String userId) { void setUser(String userId) {
_selectedUserId = userId; _selectedUserId = userId;

View File

@ -17,8 +17,10 @@ const settingsDB = DatabaseStruct("settings", {
"x_filc_id": String, "graph_class_avg": int, "presentation_mode": int, "bell_delay": int, "bell_delay_enabled": int, "x_filc_id": String, "graph_class_avg": int, "presentation_mode": int, "bell_delay": int, "bell_delay_enabled": int,
"grade_opening_fun": int, "icon_pack": String, "grade_opening_fun": int, "icon_pack": String,
}); });
const usersDB = DatabaseStruct( const usersDB = DatabaseStruct("users", {
"users", {"id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int}); "id": String, "name": String, "username": String, "password": String, "institute_code": String, "student": String, "role": int,
"nickname": String // premium only
});
const userDataDB = DatabaseStruct("user_data", { const userDataDB = DatabaseStruct("user_data", {
"id": String, "grades": String, "timetable": String, "exams": String, "homework": String, "messages": String, "notes": String, "id": String, "grades": String, "timetable": String, "exams": String, "homework": String, "messages": String, "notes": String,
"events": String, "absences": String, "group_averages": String, "events": String, "absences": String, "group_averages": String,

View File

@ -13,6 +13,7 @@ class User {
String name; String name;
Student student; Student student;
Role role; Role role;
String nickname;
User({ User({
String? id, String? id,
@ -22,6 +23,7 @@ class User {
required this.instituteCode, required this.instituteCode,
required this.student, required this.student,
required this.role, required this.role,
this.nickname = "",
}) { }) {
if (id != null) { if (id != null) {
this.id = id; this.id = id;
@ -39,6 +41,7 @@ class User {
name: map["name"].trim(), name: map["name"].trim(),
student: Student.fromJson(jsonDecode(map["student"])), student: Student.fromJson(jsonDecode(map["student"])),
role: Role.values[map["role"] ?? 0], role: Role.values[map["role"] ?? 0],
nickname: map["nickname"] ?? "",
); );
} }
@ -51,6 +54,7 @@ class User {
"name": name, "name": name,
"student": jsonEncode(student.json), "student": jsonEncode(student.json),
"role": role.index, "role": role.index,
"nickname": nickname,
}; };
} }

View File

@ -20,6 +20,8 @@ dependencies:
path: "../filcnaplo_desktop_ui/" path: "../filcnaplo_desktop_ui/"
filcnaplo_kreta_api: filcnaplo_kreta_api:
path: "../filcnaplo_kreta_api/" path: "../filcnaplo_kreta_api/"
filcnaplo_premium:
path: "../filcnaplo_premium/"
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter

@ -1 +1 @@
Subproject commit bcd97552227f418898d6a42f671024e479ecb1b4 Subproject commit 66a65ad6494f8b8912735ab43a524967d11b525a

@ -1 +1 @@
Subproject commit 9278bbb8ec7e1cee072812946fc72a98777c7db4 Subproject commit 8af704591c96592b7883a29977e69e798029a3aa

1
filcnaplo_premium Submodule

@ -0,0 +1 @@
Subproject commit 54b166839a9a06680b51628567749421f3d9cca8