chore: add snackbar message after pinging course participants (#3995)

pull/2245/head
ggurdin 1 month ago committed by GitHub
parent 57520bf512
commit 70f0e4ddfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5246,5 +5246,6 @@
"inviteFriendsToCourse": "Invite friends to my course",
"subscribeToUnlockActivitySummaries": "Subscribe to unlock activity summaries",
"subscribeToUnlockDefinitions": "Subscribe to unlock definitions",
"subscribeToUnlockTranscriptions": "Subscribe to unlock transcriptions"
"subscribeToUnlockTranscriptions": "Subscribe to unlock transcriptions",
"pingSent": "🔔 Course ping sent! 🔔"
}

@ -332,7 +332,18 @@ class ActivitySessionStartController extends State<ActivitySessionStartPage> {
},
);
if (mounted) setState(() {});
if (mounted) {
setState(() {});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
L10n.of(context).pingSent,
textAlign: TextAlign.center,
),
duration: const Duration(milliseconds: 2000),
),
);
}
}
Future<void> playWithBot() async {

@ -125,7 +125,7 @@ class PayloadClient {
'$basePath/$collection${queryParams.isNotEmpty ? '?${queryStringify(queryParams)}' : ''}';
final response = await get(endpoint);
if (response.statusCode != 200) {
if (response.statusCode >= 400) {
throw Exception(
'Failed to load documents: ${response.statusCode} ${response.body}',
);
@ -144,6 +144,11 @@ class PayloadClient {
) async {
final endpoint = '$basePath/$collection/$id';
final response = await get(endpoint);
if (response.statusCode >= 400) {
throw Exception(
'Failed to load document: ${response.statusCode} ${response.body}',
);
}
final json = jsonDecode(response.body) as Map<String, dynamic>;
return fromJson(json);
}
@ -156,6 +161,13 @@ class PayloadClient {
) async {
final endpoint = '$basePath/$collection';
final response = await post(endpoint, data);
if (response.statusCode >= 400) {
throw Exception(
'Failed to create document: ${response.statusCode} ${response.body}',
);
}
final json = jsonDecode(response.body) as Map<String, dynamic>;
return fromJson(json);
}
@ -169,6 +181,11 @@ class PayloadClient {
) async {
final endpoint = '$basePath/$collection/$id';
final response = await patch(endpoint, data);
if (response.statusCode >= 400) {
throw Exception(
'Failed to update document: ${response.statusCode} ${response.body}',
);
}
final json = jsonDecode(response.body) as Map<String, dynamic>;
return fromJson(json);
}
@ -181,6 +198,11 @@ class PayloadClient {
) async {
final endpoint = '$basePath/$collection/$id';
final response = await delete(endpoint);
if (response.statusCode >= 400) {
throw Exception(
'Failed to delete document: ${response.statusCode} ${response.body}',
);
}
final json = jsonDecode(response.body) as Map<String, dynamic>;
return fromJson(json);
}

Loading…
Cancel
Save