Added api for custom timetable events
This commit is contained in:
@ -38,12 +38,12 @@ class AccountData {
|
||||
return _password!;
|
||||
}
|
||||
|
||||
String getUserId() {
|
||||
String getUserSecret() {
|
||||
return sha512.convert(utf8.encode("${AccountData().getUsername()}:${AccountData().getPassword()}")).toString();
|
||||
}
|
||||
|
||||
Future<String> getDeviceId() async {
|
||||
return sha512.convert(utf8.encode("${getUserId()}@${await FirebaseMessaging.instance.getToken()}")).toString();
|
||||
return sha512.convert(utf8.encode("${getUserSecret()}@${await FirebaseMessaging.instance.getToken()}")).toString();
|
||||
}
|
||||
|
||||
Future<void> setData(String username, String password) async {
|
||||
|
@ -1,6 +1,9 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../api/apiResponse.dart';
|
||||
import '../../api/mhsl/customTimetableEvent/get/getCustomTimetableEventCache.dart';
|
||||
import '../../api/mhsl/customTimetableEvent/get/getCustomTimetableEventParams.dart';
|
||||
import '../../api/mhsl/customTimetableEvent/get/getCustomTimetableEventResponse.dart';
|
||||
import '../../api/webuntis/queries/getHolidays/getHolidaysCache.dart';
|
||||
import '../../api/webuntis/queries/getHolidays/getHolidaysResponse.dart';
|
||||
import '../../api/webuntis/queries/getRooms/getRoomsCache.dart';
|
||||
@ -10,6 +13,7 @@ import '../../api/webuntis/queries/getSubjects/getSubjectsResponse.dart';
|
||||
import '../../api/webuntis/queries/getTimetable/getTimetableCache.dart';
|
||||
import '../../api/webuntis/queries/getTimetable/getTimetableResponse.dart';
|
||||
import '../../api/webuntis/webuntisError.dart';
|
||||
import '../accountData.dart';
|
||||
import '../dataHolder.dart';
|
||||
|
||||
class TimetableProps extends DataHolder {
|
||||
@ -30,17 +34,20 @@ class TimetableProps extends DataHolder {
|
||||
GetHolidaysResponse? _getHolidaysResponse;
|
||||
GetHolidaysResponse get getHolidaysResponse => _getHolidaysResponse!;
|
||||
|
||||
GetCustomTimetableEventResponse? _getCustomTimetableEventResponse;
|
||||
GetCustomTimetableEventResponse get getCustomTimetableEventResponse => _getCustomTimetableEventResponse!;
|
||||
|
||||
WebuntisError? error;
|
||||
WebuntisError? get getError => error;
|
||||
bool get hasError => error != null;
|
||||
|
||||
@override
|
||||
List<ApiResponse?> properties() {
|
||||
return [_getTimetableResponse, _getRoomsResponse, _getSubjectsResponse, _getHolidaysResponse];
|
||||
return [_getTimetableResponse, _getRoomsResponse, _getSubjectsResponse, _getHolidaysResponse, _getCustomTimetableEventResponse];
|
||||
}
|
||||
|
||||
@override
|
||||
void run() {
|
||||
void run({renew}) {
|
||||
GetTimetableCache(
|
||||
startdate: int.parse(DateFormat("yyyyMMdd").format(startDate)),
|
||||
enddate: int.parse(DateFormat("yyyyMMdd").format(endDate)),
|
||||
@ -78,6 +85,17 @@ class TimetableProps extends DataHolder {
|
||||
// {"jsonrpc":"2.0","id":"ID","result":[]}
|
||||
// """));
|
||||
|
||||
GetCustomTimetableEventCache(
|
||||
renew: renew,
|
||||
GetCustomTimetableEventParams(
|
||||
AccountData().getUserSecret()
|
||||
),
|
||||
onUpdate: (GetCustomTimetableEventResponse data) => {
|
||||
_getCustomTimetableEventResponse = data,
|
||||
notifyListeners(),
|
||||
}
|
||||
);
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user