forked from firka/firka
firka: use kreta_api for API models and types
This commit is contained in:
@@ -3,14 +3,11 @@ import 'dart:convert';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:firka/api/model/all_lessons.dart';
|
|
||||||
import 'package:firka/api/model/class_group.dart';
|
|
||||||
import 'package:firka/api/model/homework.dart';
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/data/models/generic_cache_model.dart';
|
import 'package:firka/data/models/generic_cache_model.dart';
|
||||||
import 'package:firka/data/models/timetable_cache_model.dart';
|
import 'package:firka/data/models/timetable_cache_model.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:isar_community/isar.dart';
|
import 'package:isar_community/isar.dart';
|
||||||
|
import 'package:kreta_api/kreta_api.dart' hide KretaEndpoints;
|
||||||
|
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
import 'package:firka/core/bloc/reauth_cubit.dart';
|
import 'package:firka/core/bloc/reauth_cubit.dart';
|
||||||
@@ -20,12 +17,6 @@ import 'package:firka/core/debug_helper.dart';
|
|||||||
import 'package:firka/services/active_account_helper.dart';
|
import 'package:firka/services/active_account_helper.dart';
|
||||||
import 'package:firka/services/watch_sync_helper.dart';
|
import 'package:firka/services/watch_sync_helper.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import '../exceptions/token.dart';
|
|
||||||
import '../model/grade.dart';
|
|
||||||
import '../model/notice_board.dart';
|
|
||||||
import '../model/omission.dart';
|
|
||||||
import '../model/student.dart';
|
|
||||||
import '../model/test.dart';
|
|
||||||
import '../token_grant.dart';
|
import '../token_grant.dart';
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
@@ -38,25 +29,6 @@ const backoffCount = 4;
|
|||||||
const backoffMin = 100;
|
const backoffMin = 100;
|
||||||
const backoffStep = 500;
|
const backoffStep = 500;
|
||||||
|
|
||||||
class ApiResponse<T> {
|
|
||||||
T? response;
|
|
||||||
int statusCode;
|
|
||||||
String? err;
|
|
||||||
bool cached;
|
|
||||||
|
|
||||||
ApiResponse(this.response, this.statusCode, this.err, this.cached);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return "ApiResponse("
|
|
||||||
"response: $response, "
|
|
||||||
"statusCode: $statusCode, "
|
|
||||||
"err: \"$err\", "
|
|
||||||
"cached: $cached"
|
|
||||||
")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class KretaClient {
|
class KretaClient {
|
||||||
Completer<void>? _tokenMutexCompleter;
|
Completer<void>? _tokenMutexCompleter;
|
||||||
TokenModel model;
|
TokenModel model;
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
import 'package:firka/api/model/class_group.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/homework.dart';
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
|
||||||
import 'package:firka/api/model/omission.dart';
|
|
||||||
import 'package:firka/api/model/test.dart';
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
|
|
||||||
import '../model/grade.dart';
|
|
||||||
import '../model/student.dart';
|
|
||||||
import 'kreta_client.dart';
|
import 'kreta_client.dart';
|
||||||
|
|
||||||
bool getStudentFL = false;
|
bool getStudentFL = false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
|
import 'package:kreta_api/kreta_api.dart' as ka;
|
||||||
|
|
||||||
class Constants {
|
class Constants {
|
||||||
static String get clientId {
|
static String get clientId {
|
||||||
@@ -41,8 +42,6 @@ class TimetableConsts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class KretaEndpoints {
|
class KretaEndpoints {
|
||||||
static String kretaBase = "e-kreta.hu";
|
|
||||||
|
|
||||||
static String _generateCodeVerifier() {
|
static String _generateCodeVerifier() {
|
||||||
var random = Random.secure();
|
var random = Random.secure();
|
||||||
final bytes = List<int>.generate(32, (i) => random.nextInt(256));
|
final bytes = List<int>.generate(32, (i) => random.nextInt(256));
|
||||||
@@ -64,13 +63,7 @@ class KretaEndpoints {
|
|||||||
return base64Url.encode(bytes).replaceAll('=', '');
|
return base64Url.encode(bytes).replaceAll('=', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
static String kreta(String iss) {
|
static String kreta(String iss) => ka.KretaEndpoints.kreta(iss);
|
||||||
if (iss == "firka-test") {
|
|
||||||
return kretaBase;
|
|
||||||
} else {
|
|
||||||
return "https://$iss.$kretaBase";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static final String codeVerifier = _generateCodeVerifier();
|
static final String codeVerifier = _generateCodeVerifier();
|
||||||
static final String _codeChallenge = _generateCodeChallenge(codeVerifier);
|
static final String _codeChallenge = _generateCodeChallenge(codeVerifier);
|
||||||
@@ -86,38 +79,28 @@ class KretaEndpoints {
|
|||||||
static String tokenGrantUrl = "$kretaIdp/connect/token";
|
static String tokenGrantUrl = "$kretaIdp/connect/token";
|
||||||
|
|
||||||
static String getStudentUrl(String iss) =>
|
static String getStudentUrl(String iss) =>
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/TanuloAdatlap";
|
ka.KretaEndpoints.getStudentUrl(iss);
|
||||||
|
|
||||||
static String getClassGroups(String iss) =>
|
static String getClassGroups(String iss) =>
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/OsztalyCsoportok";
|
ka.KretaEndpoints.getClassGroups(iss);
|
||||||
|
|
||||||
static String getNoticeBoard(String iss) =>
|
static String getNoticeBoard(String iss) =>
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/FaliujsagElemek";
|
ka.KretaEndpoints.getNoticeBoard(iss);
|
||||||
|
|
||||||
// for some reason the [redacted] devs decided to make
|
static String getInfoBoard(String iss) => ka.KretaEndpoints.getInfoBoard(iss);
|
||||||
// two different apis to get items for the notice board
|
|
||||||
// that appears on the home screen, like wtf
|
|
||||||
static String getInfoBoard(String iss) =>
|
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/Feljegyzesek";
|
|
||||||
|
|
||||||
static String getGrades(String iss) =>
|
static String getGrades(String iss) => ka.KretaEndpoints.getGrades(iss);
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/Ertekelesek";
|
|
||||||
|
|
||||||
static String getSubjectAvg(String iss, String studyGroupId) =>
|
static String getSubjectAvg(String iss, String studyGroupId) =>
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/Ertekelesek/Atlagok/TantargyiAtlagok?oktatasiNevelesiFeladatUid=$studyGroupId&oktatasiNevelesiFeladatUid=$studyGroupId";
|
ka.KretaEndpoints.getSubjectAvg(iss, studyGroupId);
|
||||||
|
|
||||||
static String getTimeTable(String iss) =>
|
static String getTimeTable(String iss) => ka.KretaEndpoints.getTimeTable(iss);
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/OrarendElemek";
|
|
||||||
|
|
||||||
static String getOmissions(String iss) =>
|
static String getOmissions(String iss) => ka.KretaEndpoints.getOmissions(iss);
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/Mulasztasok";
|
|
||||||
|
|
||||||
static String getHomework(String iss) =>
|
static String getHomework(String iss) => ka.KretaEndpoints.getHomework(iss);
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/HaziFeladatok";
|
|
||||||
|
|
||||||
static String getTests(String iss) =>
|
static String getTests(String iss) => ka.KretaEndpoints.getTests(iss);
|
||||||
"${kreta(iss)}/ellenorzo/v3/sajat/BejelentettSzamonkeresek";
|
|
||||||
|
|
||||||
static String getLessons(String iss) =>
|
static String getLessons(String iss) => ka.KretaEndpoints.getLessons(iss);
|
||||||
"${kreta(iss)}/dktapi/intezmenyek/munkaterek/tanulok";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
class TokenExpiredException implements Exception {
|
|
||||||
TokenExpiredException();
|
|
||||||
}
|
|
||||||
|
|
||||||
class InvalidGrantException implements Exception {
|
|
||||||
InvalidGrantException();
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
class AllLessons {
|
|
||||||
final String schoolId;
|
|
||||||
final String yearId;
|
|
||||||
final dynamic classId;
|
|
||||||
final String? className;
|
|
||||||
final bool classWorkspace;
|
|
||||||
final dynamic groupId;
|
|
||||||
final String? groupName;
|
|
||||||
final bool groupWorkspace;
|
|
||||||
final String groupWorkspaceName;
|
|
||||||
final dynamic subjectId;
|
|
||||||
final String subjectName;
|
|
||||||
final dynamic teacherId;
|
|
||||||
final String teacherGuid;
|
|
||||||
final String teacherName;
|
|
||||||
final dynamic teacherAnnoId;
|
|
||||||
final dynamic annoId;
|
|
||||||
final String? languageId;
|
|
||||||
final dynamic subjectCategoryId;
|
|
||||||
final String subjectCategoryName;
|
|
||||||
final dynamic typeId;
|
|
||||||
final String typeName;
|
|
||||||
final dynamic gradeTypeId;
|
|
||||||
final String gradeTypeName;
|
|
||||||
final dynamic taskPlaceId;
|
|
||||||
final String taskPlaceName;
|
|
||||||
final dynamic teacherAvatarTypeId;
|
|
||||||
final String teacherAvatarTypePath;
|
|
||||||
final dynamic taskGroupId;
|
|
||||||
|
|
||||||
AllLessons({
|
|
||||||
required this.schoolId,
|
|
||||||
required this.yearId,
|
|
||||||
this.classId,
|
|
||||||
this.className,
|
|
||||||
required this.classWorkspace,
|
|
||||||
this.groupId,
|
|
||||||
this.groupName,
|
|
||||||
required this.groupWorkspace,
|
|
||||||
required this.groupWorkspaceName,
|
|
||||||
required this.subjectId,
|
|
||||||
required this.subjectName,
|
|
||||||
required this.teacherId,
|
|
||||||
required this.teacherGuid,
|
|
||||||
required this.teacherName,
|
|
||||||
this.teacherAnnoId,
|
|
||||||
this.annoId,
|
|
||||||
this.languageId,
|
|
||||||
required this.subjectCategoryId,
|
|
||||||
required this.subjectCategoryName,
|
|
||||||
required this.typeId,
|
|
||||||
required this.typeName,
|
|
||||||
required this.gradeTypeId,
|
|
||||||
required this.gradeTypeName,
|
|
||||||
required this.taskPlaceId,
|
|
||||||
required this.taskPlaceName,
|
|
||||||
required this.teacherAvatarTypeId,
|
|
||||||
required this.teacherAvatarTypePath,
|
|
||||||
this.taskGroupId,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory AllLessons.fromJson(Map<String, dynamic> json) => AllLessons(
|
|
||||||
schoolId: json['intezmenyId']?.toString() ?? '',
|
|
||||||
yearId: json['tanevId']?.toString() ?? '',
|
|
||||||
classId: json['osztalyId'],
|
|
||||||
className: json['osztalyNev']?.toString(),
|
|
||||||
classWorkspace: json['osztalyMunkaTer'] == true,
|
|
||||||
groupId: json['csoportId'],
|
|
||||||
groupName: json['csoportNev']?.toString(),
|
|
||||||
groupWorkspace: json['csoportMunkaTer'] == true,
|
|
||||||
groupWorkspaceName: json['osztalyCsoportNev']?.toString() ?? '',
|
|
||||||
subjectId: json['tantargyId'],
|
|
||||||
subjectName: json['tantargyNev']?.toString() ?? '',
|
|
||||||
teacherId: json['alkalmazottId'],
|
|
||||||
teacherGuid: json['alkalmazottGuid']?.toString() ?? '',
|
|
||||||
teacherName: json['alkalmazottNev']?.toString() ?? '',
|
|
||||||
teacherAnnoId: json['alkalmazottUzenoFalId'],
|
|
||||||
annoId: json['uzenoFalId'],
|
|
||||||
languageId: json['nyelvId']?.toString(),
|
|
||||||
subjectCategoryId: json['tantargyKategoriaId'],
|
|
||||||
subjectCategoryName: json['tantargyKategoriaNev']?.toString() ?? '',
|
|
||||||
typeId: json['tipusId'],
|
|
||||||
typeName: json['tipusNev']?.toString() ?? '',
|
|
||||||
gradeTypeId: json['evfolyamTipusId'],
|
|
||||||
gradeTypeName: json['evfolyamTipusNev']?.toString() ?? '',
|
|
||||||
taskPlaceId: json['feladatEllatasiHelyId'],
|
|
||||||
taskPlaceName: json['feladatEllatasiHelyNev']?.toString() ?? '',
|
|
||||||
teacherAvatarTypeId: json['alkalmazottAvatarTipusId'],
|
|
||||||
teacherAvatarTypePath: json['alkalmazottAvatarEleres']?.toString() ?? '',
|
|
||||||
taskGroupId: json['oraiFeladatGroupId'],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
'intezmenyId': schoolId,
|
|
||||||
'tanevId': yearId,
|
|
||||||
'osztalyId': classId,
|
|
||||||
'osztalyNev': className,
|
|
||||||
'osztalyMunkaTer': classWorkspace,
|
|
||||||
'csoportId': groupId,
|
|
||||||
'csoportNev': groupName,
|
|
||||||
'csoportMunkaTer': groupWorkspace,
|
|
||||||
'osztalyCsoportNev': groupWorkspaceName,
|
|
||||||
'tantargyId': subjectId,
|
|
||||||
'tantargyNev': subjectName,
|
|
||||||
'alkalmazottId': teacherId,
|
|
||||||
'alkalmazottGuid': teacherGuid,
|
|
||||||
'alkalmazottNev': teacherName,
|
|
||||||
'alkalmazottUzenoFalId': teacherAnnoId,
|
|
||||||
'uzenoFalId': annoId,
|
|
||||||
'nyelvId': languageId,
|
|
||||||
'tantargyKategoriaId': subjectCategoryId,
|
|
||||||
'tantargyKategoriaNev': subjectCategoryName,
|
|
||||||
'tipusId': typeId,
|
|
||||||
'tipusNev': typeName,
|
|
||||||
'evfolyamTipusId': gradeTypeId,
|
|
||||||
'evfolyamTipusNev': gradeTypeName,
|
|
||||||
'feladatEllatasiHelyId': taskPlaceId,
|
|
||||||
'feladatEllatasiHelyNev': taskPlaceName,
|
|
||||||
'alkalmazottAvatarTipusId': teacherAvatarTypeId,
|
|
||||||
'alkalmazottAvatarEleres': teacherAvatarTypePath,
|
|
||||||
'oraiFeladatGroupId': taskGroupId,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AllLessons> lessonsFromJson(String str) =>
|
|
||||||
List<AllLessons>.from(json.decode(str).map((x) => AllLessons.fromJson(x)));
|
|
||||||
|
|
||||||
String lessonsToJson(List<AllLessons> data) =>
|
|
||||||
json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
|
|
||||||
class ClassGroup {
|
|
||||||
final String uid;
|
|
||||||
final String name;
|
|
||||||
final UidObj? headTeacher;
|
|
||||||
final UidObj? substituteHeadTeacher;
|
|
||||||
final NameUidDesc studyGroup;
|
|
||||||
final int? studyGroupSortIndex;
|
|
||||||
final NameUidDesc? studyTask;
|
|
||||||
final bool isActive;
|
|
||||||
final String type;
|
|
||||||
|
|
||||||
ClassGroup({
|
|
||||||
required this.uid,
|
|
||||||
required this.name,
|
|
||||||
required this.headTeacher,
|
|
||||||
required this.substituteHeadTeacher,
|
|
||||||
required this.studyGroup,
|
|
||||||
required this.studyGroupSortIndex,
|
|
||||||
required this.studyTask,
|
|
||||||
required this.isActive,
|
|
||||||
required this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory ClassGroup.fromJson(Map<String, dynamic> json) {
|
|
||||||
return ClassGroup(
|
|
||||||
uid: json['Uid'],
|
|
||||||
name: json['Nev'],
|
|
||||||
headTeacher: json['OsztalyFonok'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyFonok'])
|
|
||||||
: null,
|
|
||||||
substituteHeadTeacher: json['OsztalyFonokHelyettes'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyFonokHelyettes'])
|
|
||||||
: null,
|
|
||||||
studyGroup: NameUidDesc.fromJson(json['OktatasNevelesiKategoria']),
|
|
||||||
studyGroupSortIndex: json['OktatasNevelesiKategoriaSortIndex'],
|
|
||||||
studyTask: json['OktatasNevelesiFeladat'] != null
|
|
||||||
? NameUidDesc.fromJson(json['OktatasNevelesiFeladat'])
|
|
||||||
: null,
|
|
||||||
isActive: json['IsAktiv'],
|
|
||||||
type: json['Tipus'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ClassGroup('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'name: "$name", '
|
|
||||||
'headTeacher: $headTeacher, '
|
|
||||||
'substituteHeadTeacher: $substituteHeadTeacher, '
|
|
||||||
'studyGroup: $studyGroup, '
|
|
||||||
'studyGroupSortIndex: $studyGroupSortIndex, '
|
|
||||||
'studyTask: $studyTask, '
|
|
||||||
'isActive: $isActive, '
|
|
||||||
'type: "$type"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SubjectAverage {
|
|
||||||
final String uid;
|
|
||||||
final String name;
|
|
||||||
final String? teacherName;
|
|
||||||
final String subjectCategoryId;
|
|
||||||
final String subjectCategoryName;
|
|
||||||
final String subjectCategoryDescription;
|
|
||||||
final double? average;
|
|
||||||
final double? weightedSum;
|
|
||||||
final double? weightedCount;
|
|
||||||
final int sortIndex;
|
|
||||||
|
|
||||||
SubjectAverage({
|
|
||||||
required this.uid,
|
|
||||||
required this.name,
|
|
||||||
this.teacherName,
|
|
||||||
required this.subjectCategoryId,
|
|
||||||
required this.subjectCategoryName,
|
|
||||||
required this.subjectCategoryDescription,
|
|
||||||
this.average,
|
|
||||||
this.weightedSum,
|
|
||||||
this.weightedCount,
|
|
||||||
required this.sortIndex,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory SubjectAverage.fromJson(Map<String, dynamic> json) {
|
|
||||||
final tantargy = json['Tantargy'] ?? {};
|
|
||||||
final kategori = tantargy['Kategoria'] ?? {};
|
|
||||||
|
|
||||||
return SubjectAverage(
|
|
||||||
uid: json['Uid'] ?? '',
|
|
||||||
name: tantargy['Nev'] ?? '',
|
|
||||||
teacherName: json['TeacherName'],
|
|
||||||
subjectCategoryId: kategori['Uid'] ?? '',
|
|
||||||
subjectCategoryName: kategori['Nev'] ?? '',
|
|
||||||
subjectCategoryDescription: kategori['Leiras'] ?? '',
|
|
||||||
average: json['Atlag'] != null ? (json['Atlag'] as num).toDouble() : null,
|
|
||||||
weightedSum: json['SulyozottOsztalyzatOsszege'] != null
|
|
||||||
? (json['SulyozottOsztalyzatOsszege'] as num).toDouble()
|
|
||||||
: null,
|
|
||||||
weightedCount: json['SulyozottOsztalyzatSzama'] != null
|
|
||||||
? (json['SulyozottOsztalyzatSzama'] as num).toDouble()
|
|
||||||
: null,
|
|
||||||
sortIndex: tantargy['SortIndex'] ?? 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'SubjectAverage(uid: "$uid", name: "$name", category: "$subjectCategoryName", average: $average)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
class NameUidDesc {
|
|
||||||
final String uid;
|
|
||||||
final String? name;
|
|
||||||
final String? description;
|
|
||||||
|
|
||||||
NameUidDesc({
|
|
||||||
required this.uid,
|
|
||||||
required this.name,
|
|
||||||
required this.description,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory NameUidDesc.fromJson(Map<String, dynamic> json) {
|
|
||||||
return NameUidDesc(
|
|
||||||
uid: json['Uid'],
|
|
||||||
name: json['Nev'],
|
|
||||||
description: json['Leiras'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {'Uid': uid, 'Nev': name, 'Leiras': description};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'NameUidDesc('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'name: "$name", '
|
|
||||||
'description: "$description"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NameUid {
|
|
||||||
final String uid;
|
|
||||||
final String name;
|
|
||||||
|
|
||||||
NameUid({required this.uid, required this.name});
|
|
||||||
|
|
||||||
factory NameUid.fromJson(Map<String, dynamic> json) {
|
|
||||||
return NameUid(uid: json['Uid'], name: json['Nev']);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {'Uid': uid, 'Nev': name};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class UidObj {
|
|
||||||
final String uid;
|
|
||||||
|
|
||||||
UidObj({required this.uid});
|
|
||||||
|
|
||||||
factory UidObj.fromJson(Map<String, dynamic> json) {
|
|
||||||
return UidObj(uid: json['Uid']);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'UidObj('
|
|
||||||
'uid: "$uid"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
class Grade {
|
|
||||||
final String uid;
|
|
||||||
final DateTime recordDate;
|
|
||||||
final DateTime creationDate;
|
|
||||||
final DateTime? ackDate;
|
|
||||||
final Subject subject;
|
|
||||||
final String? topic;
|
|
||||||
final NameUidDesc type;
|
|
||||||
final NameUidDesc? mode;
|
|
||||||
NameUidDesc valueType;
|
|
||||||
final String teacher;
|
|
||||||
final String? kind;
|
|
||||||
int? numericValue;
|
|
||||||
final String strValue;
|
|
||||||
final int? weightPercentage;
|
|
||||||
final String? shortStrValue;
|
|
||||||
final UidObj? classGroup;
|
|
||||||
final int sortIndex;
|
|
||||||
|
|
||||||
Grade({
|
|
||||||
required this.uid,
|
|
||||||
required this.recordDate,
|
|
||||||
required this.creationDate,
|
|
||||||
this.ackDate,
|
|
||||||
required this.subject,
|
|
||||||
this.topic,
|
|
||||||
required this.type,
|
|
||||||
this.mode,
|
|
||||||
required this.valueType,
|
|
||||||
required this.teacher,
|
|
||||||
this.kind,
|
|
||||||
this.numericValue,
|
|
||||||
required this.strValue,
|
|
||||||
this.weightPercentage,
|
|
||||||
this.shortStrValue,
|
|
||||||
this.classGroup,
|
|
||||||
required this.sortIndex,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Grade.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Grade(
|
|
||||||
uid: json['Uid'],
|
|
||||||
recordDate: DateTime.parse(json['RogzitesDatuma']).toLocal(),
|
|
||||||
creationDate: DateTime.parse(json['KeszitesDatuma']).toLocal(),
|
|
||||||
ackDate: json['LattamozasDatuma'] != null
|
|
||||||
? DateTime.parse(json['LattamozasDatuma']).toLocal()
|
|
||||||
: null,
|
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
|
||||||
topic: json['Tema'],
|
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
|
||||||
mode: json['Mod'] != null ? NameUidDesc.fromJson(json['Mod']) : null,
|
|
||||||
valueType: NameUidDesc.fromJson(json['ErtekFajta']),
|
|
||||||
teacher: json['ErtekeloTanarNeve'],
|
|
||||||
kind: json['Kind'],
|
|
||||||
numericValue: json['SzamErtek'],
|
|
||||||
strValue: json['SzovegesErtek'],
|
|
||||||
weightPercentage: json['SulySzazalekErteke'],
|
|
||||||
shortStrValue: json['SzovegesErtekelesRovidNev'],
|
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
sortIndex: json['SortIndex'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'Uid': uid,
|
|
||||||
'RogzitesDatuma': recordDate.toUtc().toIso8601String(),
|
|
||||||
'KeszitesDatuma': creationDate.toUtc().toIso8601String(),
|
|
||||||
'LattamozasDatuma': ackDate?.toUtc().toIso8601String(),
|
|
||||||
'Tantargy': subject.toJson(),
|
|
||||||
'Tema': topic,
|
|
||||||
'Tipus': type.toJson(),
|
|
||||||
'Mod': mode?.toJson(),
|
|
||||||
'ErtekFajta': valueType.toJson(),
|
|
||||||
'ErtekeloTanarNeve': teacher,
|
|
||||||
'Kind': kind,
|
|
||||||
'SzamErtek': numericValue,
|
|
||||||
'SzovegesErtek': strValue,
|
|
||||||
'SulySzazalekErteke': weightPercentage,
|
|
||||||
'SzovegesErtekelesRovidNev': shortStrValue,
|
|
||||||
'OsztalyCsoport': classGroup != null ? {'Uid': classGroup!.uid} : null,
|
|
||||||
'SortIndex': sortIndex,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Grade('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'recordDate: "$recordDate", '
|
|
||||||
'creationDate: "$creationDate", '
|
|
||||||
'ackDate: "${ackDate ?? 'null'}", '
|
|
||||||
'subject: $subject, '
|
|
||||||
'topic: "${topic ?? 'null'}", '
|
|
||||||
'type: $type, '
|
|
||||||
'mode: ${mode ?? 'null'}, '
|
|
||||||
'valueType: $valueType, '
|
|
||||||
'teacher: "$teacher", '
|
|
||||||
'kind: "${kind ?? 'null'}", '
|
|
||||||
'numericValue: ${numericValue ?? 'null'}, '
|
|
||||||
'strValue: "$strValue", '
|
|
||||||
'weightPercentage: ${weightPercentage ?? 'null'}, '
|
|
||||||
'shortStrValue: "${shortStrValue ?? 'null'}", '
|
|
||||||
'classGroup: ${classGroup ?? 'null'}, '
|
|
||||||
'sortIndex: $sortIndex'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
class Guardian {
|
|
||||||
final String? email;
|
|
||||||
final bool isLegalRepresentative;
|
|
||||||
final String? name;
|
|
||||||
final String? phoneNumber;
|
|
||||||
final String uid;
|
|
||||||
|
|
||||||
Guardian({
|
|
||||||
required this.email,
|
|
||||||
required this.isLegalRepresentative,
|
|
||||||
required this.name,
|
|
||||||
required this.phoneNumber,
|
|
||||||
required this.uid,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Guardian.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Guardian(
|
|
||||||
email: json['EmailCim'],
|
|
||||||
isLegalRepresentative: json['IsTorvenyesKepviselo'],
|
|
||||||
name: json['Nev'],
|
|
||||||
phoneNumber: json['Telefonszam'],
|
|
||||||
uid: json['Uid'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Guardian('
|
|
||||||
'email: "$email", '
|
|
||||||
'isLegalRepresentative: $isLegalRepresentative, '
|
|
||||||
'name: "$name", '
|
|
||||||
'phoneNumber: "$phoneNumber", '
|
|
||||||
'uid: "$uid"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
import 'generic.dart';
|
|
||||||
|
|
||||||
class Homework {
|
|
||||||
final String uid;
|
|
||||||
final Subject subject;
|
|
||||||
final String subjectName;
|
|
||||||
final String teacherName;
|
|
||||||
final String description;
|
|
||||||
final DateTime startDate;
|
|
||||||
final DateTime dueDate;
|
|
||||||
final DateTime creationDate;
|
|
||||||
final bool isCreatedByTeacher;
|
|
||||||
final bool isDone;
|
|
||||||
final bool canBeSubmitted;
|
|
||||||
final UidObj classGroup;
|
|
||||||
final bool canAttach;
|
|
||||||
|
|
||||||
Homework({
|
|
||||||
required this.uid,
|
|
||||||
required this.subject,
|
|
||||||
required this.subjectName,
|
|
||||||
required this.teacherName,
|
|
||||||
required this.description,
|
|
||||||
required this.startDate,
|
|
||||||
required this.dueDate,
|
|
||||||
required this.creationDate,
|
|
||||||
required this.isCreatedByTeacher,
|
|
||||||
required this.isDone,
|
|
||||||
required this.canBeSubmitted,
|
|
||||||
required this.classGroup,
|
|
||||||
required this.canAttach,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Homework.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Homework(
|
|
||||||
uid: json["Uid"],
|
|
||||||
subject: Subject.fromJson(json["Tantargy"]),
|
|
||||||
subjectName: json["TantargyNeve"],
|
|
||||||
teacherName: json["RogzitoTanarNeve"],
|
|
||||||
description: json["Szoveg"],
|
|
||||||
startDate: DateTime.parse(json["FeladasDatuma"]).toLocal(),
|
|
||||||
dueDate: DateTime.parse(json["HataridoDatuma"]).toLocal(),
|
|
||||||
creationDate: DateTime.parse(json["RogzitesIdopontja"]).toLocal(),
|
|
||||||
isCreatedByTeacher: json["IsTanarRogzitette"],
|
|
||||||
isDone: json["IsMegoldva"],
|
|
||||||
canBeSubmitted: json["IsBeadhato"],
|
|
||||||
classGroup: UidObj.fromJson(json["OsztalyCsoport"]),
|
|
||||||
canAttach: json["IsCsatolasEngedelyezes"],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Homework('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'subject: $subject, '
|
|
||||||
'subjectName: "$subjectName", '
|
|
||||||
'teacherName: "$teacherName", '
|
|
||||||
'description: "$description", '
|
|
||||||
'startDate: $startDate, '
|
|
||||||
'dueDate: $dueDate, '
|
|
||||||
'creationDate: $creationDate, '
|
|
||||||
'isCreatedByTeacher: $isCreatedByTeacher, '
|
|
||||||
'isDone: $isDone, '
|
|
||||||
'canBeSubmitted: $canBeSubmitted, '
|
|
||||||
'classGroup: $classGroup, '
|
|
||||||
'canAttach: $canAttach'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
class Institution {
|
|
||||||
final CustomizationSettings customizationSettings;
|
|
||||||
final String shortName;
|
|
||||||
final List<SystemModule> systemModuleList;
|
|
||||||
final String uid;
|
|
||||||
|
|
||||||
Institution({
|
|
||||||
required this.customizationSettings,
|
|
||||||
required this.shortName,
|
|
||||||
required this.systemModuleList,
|
|
||||||
required this.uid,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Institution.fromJson(Map<String, dynamic> json) {
|
|
||||||
var systemModuleList = List<SystemModule>.empty(growable: true);
|
|
||||||
|
|
||||||
for (var item in json['Rendszermodulok']) {
|
|
||||||
systemModuleList.add(SystemModule.fromJson(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Institution(
|
|
||||||
customizationSettings: CustomizationSettings.fromJson(
|
|
||||||
json['TestreszabasBeallitasok'],
|
|
||||||
),
|
|
||||||
shortName: json['RovidNev'],
|
|
||||||
systemModuleList: systemModuleList,
|
|
||||||
uid: json['Uid'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomizationSettings {
|
|
||||||
final int delayForNotifications;
|
|
||||||
final bool isClassAverageVisible;
|
|
||||||
final bool isLessonsThemeVisible;
|
|
||||||
final String nextServerDeployAsString;
|
|
||||||
|
|
||||||
CustomizationSettings({
|
|
||||||
required this.delayForNotifications,
|
|
||||||
required this.isClassAverageVisible,
|
|
||||||
required this.isLessonsThemeVisible,
|
|
||||||
required this.nextServerDeployAsString,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory CustomizationSettings.fromJson(Map<String, dynamic> json) {
|
|
||||||
return CustomizationSettings(
|
|
||||||
delayForNotifications:
|
|
||||||
json['ErtekelesekMegjelenitesenekKesleltetesenekMerteke'],
|
|
||||||
isClassAverageVisible: json['IsOsztalyAtlagMegjeleniteseEllenorzoben'],
|
|
||||||
isLessonsThemeVisible: json['IsTanorakTemajaMegtekinthetoEllenorzoben'],
|
|
||||||
nextServerDeployAsString: json['KovetkezoTelepitesDatuma'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'CustomizationSettings('
|
|
||||||
'delayForNotifications: $delayForNotifications, '
|
|
||||||
'isClassAverageVisible: $isClassAverageVisible, '
|
|
||||||
'isLessonsThemeVisible: $isLessonsThemeVisible, '
|
|
||||||
'nextServerDeployAsString: "$nextServerDeployAsString"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SystemModule {
|
|
||||||
final bool isActive;
|
|
||||||
final String type;
|
|
||||||
final String? url;
|
|
||||||
|
|
||||||
SystemModule({required this.isActive, required this.type, required this.url});
|
|
||||||
|
|
||||||
factory SystemModule.fromJson(Map<String, dynamic> json) {
|
|
||||||
return SystemModule(
|
|
||||||
isActive: json['IsAktiv'],
|
|
||||||
type: json['Tipus'],
|
|
||||||
url: json['Url'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'SystemModule('
|
|
||||||
'isActive: $isActive, '
|
|
||||||
'type: "$type", '
|
|
||||||
'url: "$url"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
|
|
||||||
class NoticeBoardItem {
|
|
||||||
final String uid;
|
|
||||||
final String author;
|
|
||||||
final DateTime validFrom;
|
|
||||||
final DateTime validTo;
|
|
||||||
final String title;
|
|
||||||
final String contentHTML;
|
|
||||||
final String contentText;
|
|
||||||
|
|
||||||
NoticeBoardItem({
|
|
||||||
required this.uid,
|
|
||||||
required this.author,
|
|
||||||
required this.validFrom,
|
|
||||||
required this.validTo,
|
|
||||||
required this.title,
|
|
||||||
required this.contentHTML,
|
|
||||||
required this.contentText,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory NoticeBoardItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
return NoticeBoardItem(
|
|
||||||
uid: json['Uid'],
|
|
||||||
author: json['RogzitoNeve'],
|
|
||||||
validFrom: DateTime.parse(json['ErvenyessegKezdete']),
|
|
||||||
validTo: DateTime.parse(json['ErvenyessegVege']),
|
|
||||||
title: json['Cim'],
|
|
||||||
contentHTML: json['Tartalom'],
|
|
||||||
contentText: json['TartalomText'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'NoticeBoardItem('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'author: "$author", '
|
|
||||||
'validFrom: "$validFrom", '
|
|
||||||
'validTo: "$validTo", '
|
|
||||||
'title: "$title", '
|
|
||||||
'contentHTML: "$contentHTML", '
|
|
||||||
'contentText: "$contentText"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class InfoBoardItem {
|
|
||||||
final String uid;
|
|
||||||
final String title;
|
|
||||||
final DateTime date;
|
|
||||||
final String author;
|
|
||||||
final DateTime createdAt;
|
|
||||||
final String contentHTML;
|
|
||||||
final String contentText;
|
|
||||||
final NameUidDesc type;
|
|
||||||
|
|
||||||
InfoBoardItem({
|
|
||||||
required this.uid,
|
|
||||||
required this.title,
|
|
||||||
required this.date,
|
|
||||||
required this.author,
|
|
||||||
required this.createdAt,
|
|
||||||
required this.contentHTML,
|
|
||||||
required this.contentText,
|
|
||||||
required this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory InfoBoardItem.fromJson(Map<String, dynamic> json) {
|
|
||||||
return InfoBoardItem(
|
|
||||||
uid: json['Uid'],
|
|
||||||
title: json['Cim'],
|
|
||||||
date: DateTime.parse(json['Datum']),
|
|
||||||
author: json['KeszitoTanarNeve'],
|
|
||||||
createdAt: DateTime.parse(json['KeszitesDatuma']),
|
|
||||||
contentText: json['Tartalom'],
|
|
||||||
contentHTML: json['TartalomFormazott'],
|
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'InfoBoard('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'title: "$title", '
|
|
||||||
'date: "$date", '
|
|
||||||
'author: "$author", '
|
|
||||||
'createdAt: "$createdAt", '
|
|
||||||
'contentText: "$contentText", '
|
|
||||||
'contentHTML: "$contentHTML", '
|
|
||||||
'type: $type'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
class Omission {
|
|
||||||
final String uid;
|
|
||||||
final Subject subject;
|
|
||||||
final Class? c;
|
|
||||||
final DateTime date;
|
|
||||||
final String teacher;
|
|
||||||
final NameUidDesc? type;
|
|
||||||
final NameUidDesc? mode;
|
|
||||||
final int? lateForMin;
|
|
||||||
final DateTime createdAt;
|
|
||||||
final String state;
|
|
||||||
final NameUidDesc? proofType;
|
|
||||||
final UidObj? classGroup;
|
|
||||||
|
|
||||||
Omission({
|
|
||||||
required this.uid,
|
|
||||||
required this.subject,
|
|
||||||
required this.c,
|
|
||||||
required this.date,
|
|
||||||
required this.teacher,
|
|
||||||
this.type,
|
|
||||||
this.mode,
|
|
||||||
this.lateForMin,
|
|
||||||
required this.createdAt,
|
|
||||||
required this.state,
|
|
||||||
required this.proofType,
|
|
||||||
this.classGroup,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Omission.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Omission(
|
|
||||||
uid: json['Uid'],
|
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
|
||||||
c: json['Osztaly'] != null ? Class.fromJson(json['Osztaly']) : null,
|
|
||||||
date: DateTime.parse(json['Datum']).toLocal(),
|
|
||||||
teacher: json['RogzitoTanarNeve'],
|
|
||||||
type: json['Tipus'] != null ? NameUidDesc.fromJson(json['Tipus']) : null,
|
|
||||||
mode: json['Mod'] != null ? NameUidDesc.fromJson(json['Mod']) : null,
|
|
||||||
lateForMin: json['KesesPercben'],
|
|
||||||
createdAt: DateTime.parse(json['KeszitesDatuma']).toLocal(),
|
|
||||||
state: json['IgazolasAllapota'],
|
|
||||||
proofType: json['IgazolasTipusa'] != null
|
|
||||||
? NameUidDesc.fromJson(json['IgazolasTipusa'])
|
|
||||||
: null,
|
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
|
||||||
? UidObj.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Omission('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'subject: $subject, '
|
|
||||||
'c: $c, '
|
|
||||||
'date: $date, '
|
|
||||||
'teacher: "$teacher", '
|
|
||||||
'type: $type, '
|
|
||||||
'mode: $mode, '
|
|
||||||
'lateForMin: $lateForMin, '
|
|
||||||
'createdAt: $createdAt, '
|
|
||||||
'state: "$state", '
|
|
||||||
'proofType: $proofType, '
|
|
||||||
'classGroup: $classGroup'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Class {
|
|
||||||
final DateTime start;
|
|
||||||
final DateTime end;
|
|
||||||
final int classNo;
|
|
||||||
|
|
||||||
Class({required this.start, required this.end, required this.classNo});
|
|
||||||
|
|
||||||
factory Class.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Class(
|
|
||||||
start: DateTime.parse(json['KezdoDatum']).toLocal(),
|
|
||||||
end: DateTime.parse(json['VegDatum']).toLocal(),
|
|
||||||
classNo: json['Oraszam'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Class('
|
|
||||||
'start: "$start", '
|
|
||||||
'end: "$end", '
|
|
||||||
'classNo: $classNo'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
import 'package:firka/api/model/guardian.dart';
|
|
||||||
import 'package:firka/api/model/institution.dart';
|
|
||||||
import 'package:firka/core/json_helper.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
class Student {
|
|
||||||
final List<String> addressDataList;
|
|
||||||
final BankAccount bankAccount;
|
|
||||||
|
|
||||||
// final int yearOfBirth;
|
|
||||||
// final int monthOfBirth;
|
|
||||||
// final int dayOfBirth;
|
|
||||||
final DateTime birthdate;
|
|
||||||
|
|
||||||
final String? emailAddress;
|
|
||||||
final String name;
|
|
||||||
final String? phoneNumber;
|
|
||||||
|
|
||||||
final String schoolYearUID;
|
|
||||||
final String uid;
|
|
||||||
|
|
||||||
final List<Guardian> guardianList;
|
|
||||||
final String instituteCode;
|
|
||||||
final String instituteName;
|
|
||||||
|
|
||||||
final Institution institution;
|
|
||||||
|
|
||||||
Student({
|
|
||||||
required this.addressDataList,
|
|
||||||
required this.bankAccount,
|
|
||||||
// required this.yearOfBirth,
|
|
||||||
// required this.monthOfBirth,
|
|
||||||
// required this.dayOfBirth,
|
|
||||||
required this.birthdate,
|
|
||||||
required this.emailAddress,
|
|
||||||
required this.name,
|
|
||||||
required this.phoneNumber,
|
|
||||||
required this.schoolYearUID,
|
|
||||||
required this.uid,
|
|
||||||
required this.guardianList,
|
|
||||||
required this.instituteCode,
|
|
||||||
required this.instituteName,
|
|
||||||
required this.institution,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Student.fromJson(Map<String, dynamic> json) {
|
|
||||||
var guardianList = List<Guardian>.empty(growable: true);
|
|
||||||
|
|
||||||
for (var item in json['Gondviselok']) {
|
|
||||||
guardianList.add(Guardian.fromJson(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Student(
|
|
||||||
addressDataList: listToTyped<String>(json['Cimek']),
|
|
||||||
bankAccount: BankAccount.fromJson(json['Bankszamla']),
|
|
||||||
birthdate: DateFormat('yyyy-M-d').parse(
|
|
||||||
"${json['SzuletesiEv']}-${json['SzuletesiHonap']}-${json['SzuletesiNap']}",
|
|
||||||
),
|
|
||||||
emailAddress: json['EmailCim'],
|
|
||||||
name: json['Nev'],
|
|
||||||
phoneNumber: json['Telefonszam'],
|
|
||||||
schoolYearUID: json['TanevUid'],
|
|
||||||
uid: json['Uid'],
|
|
||||||
guardianList: guardianList,
|
|
||||||
instituteCode: json['IntezmenyAzonosito'],
|
|
||||||
instituteName: json['IntezmenyNev'],
|
|
||||||
institution: Institution.fromJson(json['Intezmeny']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Student('
|
|
||||||
'addressDataList: [$addressDataList], '
|
|
||||||
'bankAccount: $bankAccount, '
|
|
||||||
'birthDate: $birthdate, '
|
|
||||||
'emailAddress: "$emailAddress", '
|
|
||||||
'name: "$name", '
|
|
||||||
'phoneNumber: "$phoneNumber", '
|
|
||||||
'schoolYearUID: "$schoolYearUID", '
|
|
||||||
'uid: "$uid", '
|
|
||||||
'guardianList: [$guardianList], '
|
|
||||||
'instituteCode: "$instituteCode", '
|
|
||||||
'instituteName: "$instituteName", '
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class BankAccount {
|
|
||||||
final String? accountNumber;
|
|
||||||
final bool? isReadOnly;
|
|
||||||
final String? ownerName;
|
|
||||||
final int? ownerType;
|
|
||||||
|
|
||||||
BankAccount({
|
|
||||||
required this.accountNumber,
|
|
||||||
required this.isReadOnly,
|
|
||||||
required this.ownerName,
|
|
||||||
required this.ownerType,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory BankAccount.fromJson(Map<String, dynamic> json) {
|
|
||||||
return BankAccount(
|
|
||||||
accountNumber: json['BankszamlaSzam'],
|
|
||||||
isReadOnly: json['IsReadOnly'],
|
|
||||||
ownerName: json['BankszamlaTulajdonosNeve'],
|
|
||||||
ownerType: json['BankszamlaTulajdonosTipusId'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'BankAccount('
|
|
||||||
'accountNumber: "$accountNumber", '
|
|
||||||
'isReadOnly: "$isReadOnly", '
|
|
||||||
'ownerName: "$ownerName", '
|
|
||||||
'ownerType: "$ownerType"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import 'generic.dart';
|
|
||||||
|
|
||||||
class Subject {
|
|
||||||
final String uid;
|
|
||||||
final String name;
|
|
||||||
final NameUidDesc category;
|
|
||||||
final int sortIndex;
|
|
||||||
final String? teacherName;
|
|
||||||
|
|
||||||
Subject({
|
|
||||||
required this.uid,
|
|
||||||
required this.name,
|
|
||||||
required this.category,
|
|
||||||
required this.sortIndex,
|
|
||||||
this.teacherName,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Subject.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Subject(
|
|
||||||
uid: json['Uid'],
|
|
||||||
name: json['Nev'],
|
|
||||||
category: NameUidDesc.fromJson(json['Kategoria']),
|
|
||||||
sortIndex: json['SortIndex'],
|
|
||||||
teacherName: json['alkalmazottNev'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'Uid': uid,
|
|
||||||
'Nev': name,
|
|
||||||
'Kategoria': category.toJson(),
|
|
||||||
'SortIndex': sortIndex,
|
|
||||||
'alkalmazottNev': teacherName,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Subject('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'name: "$name", '
|
|
||||||
'category: $category, '
|
|
||||||
'sortIndex: $sortIndex, '
|
|
||||||
'nameOfTeacher: $teacherName'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
import 'generic.dart';
|
|
||||||
|
|
||||||
class Test {
|
|
||||||
final String uid;
|
|
||||||
final DateTime date;
|
|
||||||
final DateTime reportDate;
|
|
||||||
final String teacherName;
|
|
||||||
final int lessonNumber;
|
|
||||||
final Subject subject;
|
|
||||||
final String subjectName;
|
|
||||||
final String theme;
|
|
||||||
final NameUidDesc method;
|
|
||||||
final UidObj classGroup;
|
|
||||||
|
|
||||||
Test({
|
|
||||||
required this.uid,
|
|
||||||
required this.date,
|
|
||||||
required this.reportDate,
|
|
||||||
required this.teacherName,
|
|
||||||
required this.lessonNumber,
|
|
||||||
required this.subject,
|
|
||||||
required this.subjectName,
|
|
||||||
required this.theme,
|
|
||||||
required this.method,
|
|
||||||
required this.classGroup,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Test.fromJson(Map<String, dynamic> json) {
|
|
||||||
return Test(
|
|
||||||
uid: json['Uid'],
|
|
||||||
date: DateTime.parse(json['Datum']).toLocal(),
|
|
||||||
reportDate: DateTime.parse(json['BejelentesDatuma']).toLocal(),
|
|
||||||
teacherName: json['RogzitoTanarNeve'],
|
|
||||||
lessonNumber: json['OrarendiOraOraszama'],
|
|
||||||
subject: Subject.fromJson(json['Tantargy']),
|
|
||||||
subjectName: json['TantargyNeve'],
|
|
||||||
theme: json['Temaja'],
|
|
||||||
method: NameUidDesc.fromJson(json['Modja']),
|
|
||||||
classGroup: UidObj.fromJson(json['OsztalyCsoport']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Test('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'date: $date, '
|
|
||||||
'reportDate: $reportDate, '
|
|
||||||
'teacherName: "$teacherName", '
|
|
||||||
'lessonNumber: $lessonNumber, '
|
|
||||||
'subject: $subject, '
|
|
||||||
'subjectName: "$subjectName", '
|
|
||||||
'theme: "$theme", '
|
|
||||||
'method: $method, '
|
|
||||||
'classGroup: $classGroup'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
class Lesson {
|
|
||||||
final String uid;
|
|
||||||
final String date;
|
|
||||||
final DateTime start;
|
|
||||||
final DateTime end;
|
|
||||||
final String name;
|
|
||||||
final int? lessonNumber;
|
|
||||||
final int? lessonSeqNumber;
|
|
||||||
final NameUid? classGroup;
|
|
||||||
final String? teacher;
|
|
||||||
final Subject? subject;
|
|
||||||
final String? theme;
|
|
||||||
final String? roomName;
|
|
||||||
final NameUidDesc type;
|
|
||||||
final NameUidDesc? studentPresence;
|
|
||||||
final NameUidDesc state;
|
|
||||||
final String? substituteTeacher;
|
|
||||||
final String? homeworkUid;
|
|
||||||
final String? taskGroupUid;
|
|
||||||
final String? languageTaskGroupUid;
|
|
||||||
final String? assessmentUid;
|
|
||||||
final bool canStudentEditHomework;
|
|
||||||
final bool isHomeworkComplete;
|
|
||||||
final List<NameUid> attachments;
|
|
||||||
final bool isDigitalLesson;
|
|
||||||
final String? digitalDeviceList;
|
|
||||||
final String? digitalPlatformType;
|
|
||||||
final List<String> digitalSupportDeviceTypeList;
|
|
||||||
final DateTime createdAt;
|
|
||||||
final DateTime lastModifiedAt;
|
|
||||||
|
|
||||||
Lesson({
|
|
||||||
required this.uid,
|
|
||||||
required this.date,
|
|
||||||
required this.start,
|
|
||||||
required this.end,
|
|
||||||
required this.name,
|
|
||||||
this.lessonNumber,
|
|
||||||
this.lessonSeqNumber,
|
|
||||||
this.classGroup,
|
|
||||||
this.teacher,
|
|
||||||
this.subject,
|
|
||||||
this.theme,
|
|
||||||
this.roomName,
|
|
||||||
required this.type,
|
|
||||||
this.studentPresence,
|
|
||||||
required this.state,
|
|
||||||
this.substituteTeacher,
|
|
||||||
this.homeworkUid,
|
|
||||||
this.taskGroupUid,
|
|
||||||
this.languageTaskGroupUid,
|
|
||||||
this.assessmentUid,
|
|
||||||
required this.canStudentEditHomework,
|
|
||||||
required this.isHomeworkComplete,
|
|
||||||
required this.attachments,
|
|
||||||
required this.isDigitalLesson,
|
|
||||||
this.digitalDeviceList,
|
|
||||||
this.digitalPlatformType,
|
|
||||||
required this.digitalSupportDeviceTypeList,
|
|
||||||
required this.createdAt,
|
|
||||||
required this.lastModifiedAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Lesson.fromJson(Map<String, dynamic> json) {
|
|
||||||
var attachments = List<NameUid>.empty(growable: true);
|
|
||||||
var rawAttachments = json['Csatolmanyok'];
|
|
||||||
|
|
||||||
for (var attachment in rawAttachments) {
|
|
||||||
attachments.add(NameUid.fromJson(attachment));
|
|
||||||
}
|
|
||||||
return Lesson(
|
|
||||||
uid: json['Uid'],
|
|
||||||
date: json['Datum'],
|
|
||||||
start: DateTime.parse(json['KezdetIdopont']).toLocal(),
|
|
||||||
end: DateTime.parse(json['VegIdopont']).toLocal(),
|
|
||||||
name: json['Nev'],
|
|
||||||
lessonNumber: json['Oraszam'],
|
|
||||||
lessonSeqNumber: json['OraEvesSorszama'],
|
|
||||||
classGroup: json['OsztalyCsoport'] != null
|
|
||||||
? NameUid.fromJson(json['OsztalyCsoport'])
|
|
||||||
: null,
|
|
||||||
teacher: json['TanarNeve'],
|
|
||||||
subject: json['Tantargy'] != null
|
|
||||||
? Subject.fromJson(json['Tantargy'])
|
|
||||||
: null,
|
|
||||||
theme: json['Tema'],
|
|
||||||
roomName: json['TeremNeve'],
|
|
||||||
type: NameUidDesc.fromJson(json['Tipus']),
|
|
||||||
studentPresence: json['TanuloJelenlet'] != null
|
|
||||||
? NameUidDesc.fromJson(json['TanuloJelenlet'])
|
|
||||||
: null,
|
|
||||||
state: NameUidDesc.fromJson(json['Allapot']),
|
|
||||||
substituteTeacher: json['HelyettesTanarNeve'],
|
|
||||||
homeworkUid: json['HaziFeladatUid'],
|
|
||||||
taskGroupUid: json['FeladatGroupUid'],
|
|
||||||
languageTaskGroupUid: json['NyelviFeladatGroupUid'],
|
|
||||||
assessmentUid: json['BejelentettSzamonkeresUid'],
|
|
||||||
canStudentEditHomework: json['IsTanuloHaziFeladatEnabled'],
|
|
||||||
isHomeworkComplete: json['IsHaziFeladatMegoldva'],
|
|
||||||
attachments: attachments,
|
|
||||||
isDigitalLesson: json['IsDigitalisOra'],
|
|
||||||
digitalDeviceList: json['DigitalisEszkozTipus'],
|
|
||||||
digitalPlatformType: json['DigitalisPlatformTipus'],
|
|
||||||
digitalSupportDeviceTypeList:
|
|
||||||
json['DigitalisTamogatoEszkozTipusList'] != null
|
|
||||||
? List<String>.from(json['DigitalisTamogatoEszkozTipusList'])
|
|
||||||
: List<String>.empty(),
|
|
||||||
createdAt: DateTime.parse(json['Letrehozas']).toLocal(),
|
|
||||||
lastModifiedAt: DateTime.parse(json['UtolsoModositas']).toLocal(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
List<dynamic> rawAttachments = [];
|
|
||||||
|
|
||||||
for (var item in attachments) {
|
|
||||||
rawAttachments.add(item.toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
'Uid': uid,
|
|
||||||
'Datum': date,
|
|
||||||
'KezdetIdopont': start.toIso8601String(),
|
|
||||||
'VegIdopont': end.toIso8601String(),
|
|
||||||
'Nev': name,
|
|
||||||
'Oraszam': lessonNumber,
|
|
||||||
'OraEvesSorszama': lessonSeqNumber,
|
|
||||||
'OsztalyCsoport': classGroup?.toJson(),
|
|
||||||
'TanarNeve': teacher,
|
|
||||||
'Tantargy': subject?.toJson(),
|
|
||||||
'Tema': theme,
|
|
||||||
'TeremNeve': roomName,
|
|
||||||
'Tipus': type.toJson(),
|
|
||||||
'TanuloJelenlet': studentPresence?.toJson(),
|
|
||||||
'Allapot': state.toJson(),
|
|
||||||
'HelyettesTanarNeve': substituteTeacher,
|
|
||||||
'HaziFeladatUid': homeworkUid,
|
|
||||||
'FeladatGroupUid': taskGroupUid,
|
|
||||||
'NyelviFeladatGroupUid': languageTaskGroupUid,
|
|
||||||
'BejelentettSzamonkeresUid': assessmentUid,
|
|
||||||
'IsTanuloHaziFeladatEnabled': canStudentEditHomework,
|
|
||||||
'IsHaziFeladatMegoldva': isHomeworkComplete,
|
|
||||||
'Csatolmanyok': rawAttachments,
|
|
||||||
'IsDigitalisOra': isDigitalLesson,
|
|
||||||
'DigitalisEszkozTipus': digitalDeviceList,
|
|
||||||
'DigitalisPlatformTipus': digitalPlatformType,
|
|
||||||
'DigitalisTamogatoEszkozTipusList': digitalSupportDeviceTypeList,
|
|
||||||
'Letrehozas': createdAt.toIso8601String(),
|
|
||||||
'UtolsoModositas': lastModifiedAt.toIso8601String(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Lesson('
|
|
||||||
'uid: "$uid", '
|
|
||||||
'date: "$date", '
|
|
||||||
'start: $start, '
|
|
||||||
'end: $end, '
|
|
||||||
'name: "$name", '
|
|
||||||
'lessonNumber: $lessonNumber, '
|
|
||||||
'lessonSeqNumber: $lessonSeqNumber, '
|
|
||||||
'classGroup: $classGroup, '
|
|
||||||
'teacher: "$teacher", '
|
|
||||||
'subject: $subject, '
|
|
||||||
'theme: "$theme", '
|
|
||||||
'roomName: "$roomName", '
|
|
||||||
'type: $type, '
|
|
||||||
'studentPresence: $studentPresence, '
|
|
||||||
'state: $state, '
|
|
||||||
'substituteTeacher: "$substituteTeacher", '
|
|
||||||
'homeworkUid: "$homeworkUid", '
|
|
||||||
'taskGroupUid: "$taskGroupUid", '
|
|
||||||
'languageTaskGroupUid: "$languageTaskGroupUid", '
|
|
||||||
'assessmentUid: "$assessmentUid", '
|
|
||||||
'canStudentEditHomework: $canStudentEditHomework, '
|
|
||||||
'isHomeworkComplete: $isHomeworkComplete, '
|
|
||||||
'attachments: $attachments, '
|
|
||||||
'isDigitalLesson: $isDigitalLesson, '
|
|
||||||
'digitalDeviceList: "$digitalDeviceList", '
|
|
||||||
'digitalPlatformType: "$digitalPlatformType", '
|
|
||||||
'digitalSupportDeviceTypeList: $digitalSupportDeviceTypeList, '
|
|
||||||
'create: $createdAt, '
|
|
||||||
'lastModified: $lastModifiedAt'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
class TokenGrantResponse {
|
|
||||||
final String idToken;
|
|
||||||
final String accessToken;
|
|
||||||
final int expiresIn;
|
|
||||||
final String tokenType;
|
|
||||||
final String refreshToken;
|
|
||||||
final String scope;
|
|
||||||
|
|
||||||
TokenGrantResponse({
|
|
||||||
required this.idToken,
|
|
||||||
required this.accessToken,
|
|
||||||
required this.expiresIn,
|
|
||||||
required this.tokenType,
|
|
||||||
required this.refreshToken,
|
|
||||||
required this.scope,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory TokenGrantResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
return TokenGrantResponse(
|
|
||||||
idToken: json['id_token'],
|
|
||||||
accessToken: json['access_token'],
|
|
||||||
expiresIn: json['expires_in'],
|
|
||||||
tokenType: json['token_type'],
|
|
||||||
refreshToken: json['refresh_token'],
|
|
||||||
scope: json['scope'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'TokenGrant(idToken: "$idToken", accessToken: "$accessToken", '
|
|
||||||
'expiresIn: $expiresIn, '
|
|
||||||
'tokenType: "$tokenType", '
|
|
||||||
'refreshToken: "$refreshToken", '
|
|
||||||
'scope: "$scope"'
|
|
||||||
')';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:firka/api/exceptions/token.dart';
|
|
||||||
import 'package:firka/api/resp/token_grant.dart';
|
|
||||||
import 'package:firka/data/models/token_model.dart';
|
import 'package:firka/data/models/token_model.dart';
|
||||||
|
import 'package:kreta_api/kreta_api.dart' hide KretaEndpoints;
|
||||||
|
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
import 'consts.dart';
|
import 'consts.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
|
|
||||||
double calculateAverage(List<Grade> sortedGrades) {
|
double calculateAverage(List<Grade> sortedGrades) {
|
||||||
double totalWeight = 0.0;
|
double totalWeight = 0.0;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/l10n/app_localizations.dart';
|
import 'package:firka/l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
||||||
import 'package:firka/api/resp/token_grant.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:isar_community/isar.dart';
|
import 'package:isar_community/isar.dart';
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:firka/api/client/kreta_client.dart';
|
import 'package:firka/api/client/kreta_client.dart';
|
||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/data/ios_widget_helper.dart';
|
import 'package:firka/data/ios_widget_helper.dart';
|
||||||
import 'package:firka/core/settings.dart';
|
import 'package:firka/core/settings.dart';
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import 'package:firka/routing/shell_with_nav_bar.dart';
|
|||||||
import 'package:firka/routing/swipable_navigator_container.dart';
|
import 'package:firka/routing/swipable_navigator_container.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
|
|
||||||
GoRouter createAppRouter() {
|
GoRouter createAppRouter() {
|
||||||
return GoRouter(
|
return GoRouter(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
class LiveActivityManager {
|
class LiveActivityManager {
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:firka/api/client/kreta_client.dart';
|
import 'package:firka/api/client/kreta_client.dart';
|
||||||
import 'package:firka/api/client/live_activity_backend_client.dart';
|
import 'package:firka/api/client/live_activity_backend_client.dart';
|
||||||
import 'package:firka/api/model/generic.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/data/models/app_settings_model.dart';
|
import 'package:firka/data/models/app_settings_model.dart';
|
||||||
import 'package:firka/data/widget.dart';
|
import 'package:firka/data/widget.dart';
|
||||||
import 'package:firka/services/live_activity_manager.dart';
|
import 'package:firka/services/live_activity_manager.dart';
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import 'package:path_provider/path_provider.dart'
|
|||||||
show getApplicationDocumentsDirectory;
|
show getApplicationDocumentsDirectory;
|
||||||
|
|
||||||
import 'package:firka/api/client/kreta_client.dart';
|
import 'package:firka/api/client/kreta_client.dart';
|
||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
|
|
||||||
/// File name for the Wear OS sync cache written by the phone (Dart isolate or main).
|
/// File name for the Wear OS sync cache written by the phone (Dart isolate or main).
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import 'package:firka/api/model/generic.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/grade.dart';
|
|
||||||
import 'package:firka/api/model/homework.dart';
|
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
import 'package:firka/data/models/homework_cache_model.dart';
|
import 'package:firka/data/models/homework_cache_model.dart';
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
@@ -22,10 +19,8 @@ import 'package:firka/ui/phone/pages/home/home_grades.dart';
|
|||||||
import 'package:firka/ui/phone/widgets/lesson.dart';
|
import 'package:firka/ui/phone/widgets/lesson.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:firka/ui/shared/class_icon.dart';
|
import 'package:firka/ui/shared/class_icon.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
import 'package:firka/ui/components/grade.dart';
|
import 'package:firka/ui/components/grade.dart';
|
||||||
import 'package:firka/api/model/test.dart';
|
|
||||||
|
|
||||||
Future<void> showLessonBottomSheet(
|
Future<void> showLessonBottomSheet(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import 'package:firka/core/settings.dart';
|
|||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
|
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
|
|
||||||
int roundGrade(double grade) {
|
int roundGrade(double grade) {
|
||||||
final rounding = initData.settings
|
final rounding = initData.settings
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:firka/api/client/kreta_client.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/generic.dart';
|
|
||||||
import 'package:firka/core/average_helper.dart';
|
import 'package:firka/core/average_helper.dart';
|
||||||
import 'package:firka/routing/chart_interaction_scope.dart';
|
import 'package:firka/routing/chart_interaction_scope.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
@@ -12,10 +11,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import 'package:firka/api/consts.dart';
|
import 'package:firka/api/consts.dart';
|
||||||
import 'package:firka/api/model/class_group.dart';
|
|
||||||
import 'package:firka/api/model/grade.dart';
|
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/state/firka_state.dart';
|
import 'package:firka/core/state/firka_state.dart';
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:firka/api/client/kreta_stream.dart';
|
import 'package:firka/api/client/kreta_stream.dart';
|
||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
||||||
import 'package:firka/ui/phone/widgets/home_main_starting_soon.dart';
|
import 'package:firka/ui/phone/widgets/home_main_starting_soon.dart';
|
||||||
@@ -14,11 +14,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/homework.dart';
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
|
||||||
import 'package:firka/api/model/student.dart';
|
|
||||||
import 'package:firka/api/model/test.dart';
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/state/firka_state.dart';
|
import 'package:firka/core/state/firka_state.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:firka/api/client/kreta_client.dart';
|
|
||||||
import 'package:firka/api/client/kreta_stream.dart';
|
import 'package:firka/api/client/kreta_stream.dart';
|
||||||
import 'package:firka/api/model/test.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/core/settings.dart';
|
import 'package:firka/core/settings.dart';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:firka/api/consts.dart';
|
import 'package:firka/api/consts.dart';
|
||||||
import 'package:firka/api/model/omission.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/core/settings.dart';
|
import 'package:firka/core/settings.dart';
|
||||||
@@ -13,7 +12,6 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
|||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
import 'package:transparent_pointer/transparent_pointer.dart';
|
import 'package:transparent_pointer/transparent_pointer.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/test.dart';
|
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
import 'package:firka/core/bloc/home_refresh_cubit.dart';
|
||||||
import 'package:firka/core/state/firka_state.dart';
|
import 'package:firka/core/state/firka_state.dart';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:firka/api/client/kreta_stream.dart';
|
import 'package:firka/api/client/kreta_stream.dart';
|
||||||
import 'package:firka/api/exceptions/token.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/core/firka_bundle.dart';
|
import 'package:firka/core/firka_bundle.dart';
|
||||||
import 'package:firka/services/active_account_helper.dart';
|
import 'package:firka/services/active_account_helper.dart';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:firka/app/app_state.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/firka_bundle.dart';
|
import 'package:firka/core/firka_bundle.dart';
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
import 'package:firka/ui/shared/firka_icon.dart';
|
import 'package:firka/ui/shared/firka_icon.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/ui/components/grade_helpers.dart';
|
import 'package:firka/ui/components/grade_helpers.dart';
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
import 'package:fl_chart/fl_chart.dart';
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/ui/components/grade.dart';
|
import 'package:firka/ui/components/grade.dart';
|
||||||
import 'package:firka/ui/components/grade_helpers.dart';
|
import 'package:firka/ui/components/grade_helpers.dart';
|
||||||
import 'package:firka/ui/shared/firka_icon.dart';
|
import 'package:firka/ui/shared/firka_icon.dart';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:firka/ui/theme/style.dart';
|
|||||||
import 'package:firka/ui/shared/counter_digit.dart';
|
import 'package:firka/ui/shared/counter_digit.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
|
|
||||||
class StartingSoonWidget extends StatelessWidget {
|
class StartingSoonWidget extends StatelessWidget {
|
||||||
final AppLocalizations l10n;
|
final AppLocalizations l10n;
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import 'package:firka/ui/shared/firka_icon.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/student.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
|
|
||||||
class WelcomeWidget extends StatefulWidget {
|
class WelcomeWidget extends StatefulWidget {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/homework.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/data/models/homework_cache_model.dart';
|
import 'package:firka/data/models/homework_cache_model.dart';
|
||||||
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:firka/ui/components/firka_card.dart';
|
|||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
|
|
||||||
// TODO: Finish
|
// TODO: Finish
|
||||||
class InfoBoardItemWidget extends StatelessWidget {
|
class InfoBoardItemWidget extends StatelessWidget {
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/test.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/debug_helper.dart';
|
import 'package:firka/core/debug_helper.dart';
|
||||||
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
||||||
import 'package:firka/ui/shared/class_icon.dart';
|
import 'package:firka/ui/shared/class_icon.dart';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:firka/api/model/test.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
import 'package:firka/l10n/app_localizations.dart';
|
import 'package:firka/l10n/app_localizations.dart';
|
||||||
@@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/ui/shared/class_icon.dart';
|
import 'package:firka/ui/shared/class_icon.dart';
|
||||||
|
|
||||||
class LessonBigWidget extends StatelessWidget {
|
class LessonBigWidget extends StatelessWidget {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:firka/l10n/app_localizations.dart';
|
|||||||
import 'package:firka/ui/theme/style.dart';
|
import 'package:firka/ui/theme/style.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/timetable.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/ui/shared/class_icon.dart';
|
import 'package:firka/ui/shared/class_icon.dart';
|
||||||
|
|
||||||
class LessonSmallWidget extends StatelessWidget {
|
class LessonSmallWidget extends StatelessWidget {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:firka/api/model/notice_board.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
|
|
||||||
// TODO: Finish
|
// TODO: Finish
|
||||||
class NoticeBoardItemWidget extends StatelessWidget {
|
class NoticeBoardItemWidget extends StatelessWidget {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:firka/api/model/test.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/timetable.dart';
|
|
||||||
import 'package:firka/core/extensions.dart';
|
import 'package:firka/core/extensions.dart';
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
import 'package:firka/app/app_state.dart';
|
import 'package:firka/app/app_state.dart';
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:firka/api/model/grade.dart';
|
import 'package:kreta_api/kreta_api.dart';
|
||||||
import 'package:firka/api/model/subject.dart';
|
|
||||||
import 'package:firka/ui/components/firka_card.dart';
|
import 'package:firka/ui/components/firka_card.dart';
|
||||||
import 'package:firka/ui/components/grade_helpers.dart';
|
import 'package:firka/ui/components/grade_helpers.dart';
|
||||||
import 'package:firka/ui/shared/class_icon.dart';
|
import 'package:firka/ui/shared/class_icon.dart';
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
kreta_api:
|
||||||
|
path: ../kreta_api
|
||||||
|
|
||||||
cupertino_icons: ^1.0.8
|
cupertino_icons: ^1.0.8
|
||||||
flutter_launcher_icons: ^0.14.3
|
flutter_launcher_icons: ^0.14.3
|
||||||
|
|||||||
Reference in New Issue
Block a user