better loading indicators for timetables, talk and files

This commit is contained in:
2026-05-05 21:07:48 +02:00
parent bee5c02a4f
commit db9c3386f1
25 changed files with 439 additions and 203 deletions
@@ -2,10 +2,26 @@ import '../../../../../api/marianumcloud/talk/chat/getChatCache.dart';
import '../../../../../api/marianumcloud/talk/chat/getChatResponse.dart';
class ChatDataProvider {
void getChat({
Future<GetChatResponse> getChat({
required String token,
required void Function(GetChatResponse data) onUpdate,
}) {
GetChatCache(chatToken: token, onUpdate: onUpdate);
void Function(GetChatResponse data)? onUpdate,
void Function(Object)? onError,
}) async {
GetChatResponse? latest;
Object? capturedError;
final cache = GetChatCache(
chatToken: token,
onUpdate: (data) {
latest = data;
onUpdate?.call(data);
},
onError: (e) {
capturedError = e;
onError?.call(e);
},
);
await cache.ready;
if (latest != null) return latest!;
throw capturedError ?? Exception('No data and no error from getChat');
}
}