Update Saqel Platform: 2026-09-08 18:19:28

This commit is contained in:
Hamza-Ayed
2026-09-08 18:19:28 +03:00
parent 75451ebc3f
commit e5cbd89323
22 changed files with 1537 additions and 595 deletions
@@ -58,16 +58,21 @@ class TeacherQnACubit extends Cubit<TeacherQnAState> {
Future<void> loadQnA() async {
emit(state.copyWith(isLoading: true));
final hwList = await repository.getHomeworks();
final doubtsList = await repository.getStudentDoubts();
final conversationsList = await repository.getConversations();
emit(state.copyWith(
homeworks: hwList,
doubts: doubtsList,
conversations: conversationsList,
isLoading: false,
));
try {
final results = await Future.wait([
repository.getHomeworks(),
repository.getStudentDoubts(),
repository.getConversations(),
]);
emit(state.copyWith(
homeworks: results[0] as List<TeacherHomeworkModel>,
doubts: results[1] as List<StudentDoubtModel>,
conversations: results[2] as List<ChatConversationModel>,
isLoading: false,
));
} catch (_) {
emit(state.copyWith(isLoading: false));
}
}
void dispatchNewHomework({
@@ -86,14 +91,19 @@ class TeacherQnACubit extends Cubit<TeacherQnAState> {
final target = state.doubts[targetIndex];
final replyText = voiceText?.trim() ?? '';
if (replyText.isEmpty) {
throw StateError('لا يمكن تسجيل رد صوتي دون ملف صوت حقيقي؛ أرسل رداً نصياً حالياً.');
throw StateError(
'لا يمكن تسجيل رد صوتي دون ملف صوت حقيقي؛ أرسل رداً نصياً حالياً.');
}
await repository.sendMessage(
receiverId: target.studentId,
message: replyText,
messageType: 'text',
);
final updated = state.doubts.map((doubt) => doubt.id == doubtId ? doubt.copyWith(replied: true, voiceReply: false) : doubt).toList();
final updated = state.doubts
.map((doubt) => doubt.id == doubtId
? doubt.copyWith(replied: true, voiceReply: false)
: doubt)
.toList();
emit(state.copyWith(doubts: updated));
}
@@ -106,8 +116,8 @@ class TeacherQnACubit extends Cubit<TeacherQnAState> {
final success = await repository.broadcastAnnouncement(
title: title,
message: explanationText,
messageType: 'voice',
mediaUrl: 'https://saqel.intaleqapp.com/assets/audio/teacher_broadcast.mp3',
messageType: 'text',
mediaUrl: null,
gradeLevel: gradeLevel,
);
emit(state.copyWith(isBroadcasting: false));