fixed warns and timetable thing again
This commit is contained in:
@@ -26,6 +26,8 @@ class KretaClient {
|
||||
late final UserProvider _user;
|
||||
late final StatusProvider _status;
|
||||
|
||||
bool _loginRefreshing = false;
|
||||
|
||||
KretaClient({
|
||||
this.accessToken,
|
||||
required SettingsProvider settings,
|
||||
@@ -164,6 +166,9 @@ class KretaClient {
|
||||
}
|
||||
|
||||
Future<void> refreshLogin() async {
|
||||
if (_loginRefreshing) return;
|
||||
_loginRefreshing = true;
|
||||
|
||||
User? loginUser = _user.user;
|
||||
if (loginUser == null) return;
|
||||
|
||||
@@ -215,5 +220,7 @@ class KretaClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_loginRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:filcnaplo_kreta_api/client/api.dart';
|
||||
import 'package:filcnaplo_kreta_api/client/client.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/lesson.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/week.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class TimetableProvider with ChangeNotifier {
|
||||
Map<Week, List<Lesson>> lessons = {};
|
||||
@@ -69,14 +69,14 @@ class TimetableProvider with ChangeNotifier {
|
||||
.getAPI(KretaAPI.timetable(iss, start: week.start, end: week.end));
|
||||
|
||||
if (lessonsJson == null) {
|
||||
if (kDebugMode) print('Cannot fetch Lessons for User ${user.id}');
|
||||
|
||||
return;
|
||||
// throw "Cannot fetch Lessons for User ${user.id}";
|
||||
} else {
|
||||
List<Lesson> lessonsList =
|
||||
lessonsJson.map((e) => Lesson.fromJson(e)).toList();
|
||||
|
||||
if (lessons.isEmpty) return;
|
||||
|
||||
lessons[week] = lessonsList;
|
||||
|
||||
await store();
|
||||
|
||||
Reference in New Issue
Block a user