diff --git a/lib/screens/tasks/it_job_checklist_tab.dart b/lib/screens/tasks/it_job_checklist_tab.dart index 6017631c..dd70519a 100644 --- a/lib/screens/tasks/it_job_checklist_tab.dart +++ b/lib/screens/tasks/it_job_checklist_tab.dart @@ -407,34 +407,34 @@ class _ItJobTileState extends ConsumerState<_ItJobTile> { } } - Future _sendReminder() async { + void _sendReminder() { final userIds = widget.assignees.map((a) => a.userId).toList(); if (userIds.isEmpty) { showErrorSnackBar(context, 'No assigned staff'); return; } - try { - final currentUserId = ref.read(currentUserIdProvider); - await ref.read(notificationsControllerProvider).createNotification( - userIds: userIds, - type: 'it_job_reminder', - actorId: currentUserId ?? '', - fields: {'task_id': widget.task.id}, - pushTitle: 'IT Job Reminder', - pushBody: - 'Please submit printed IT Job for Task #${widget.task.taskNumber ?? widget.task.id.substring(0, 8)}', - pushData: { - 'task_id': widget.task.id, - 'navigate_to': '/tasks/${widget.task.id}', - }, - ); - if (mounted) { - setState(_startCooldown); - showSuccessSnackBar(context, 'Reminder sent'); - } - } catch (e) { - if (mounted) showErrorSnackBar(context, 'Failed to send: $e'); - } + + // Start cooldown and give immediate feedback — notification fires async. + setState(_startCooldown); + showSuccessSnackBar(context, 'Reminder sent'); + + final currentUserId = ref.read(currentUserIdProvider); + ref + .read(notificationsControllerProvider) + .createNotification( + userIds: userIds, + type: 'it_job_reminder', + actorId: currentUserId ?? '', + fields: {'task_id': widget.task.id}, + pushTitle: 'IT Job Reminder', + pushBody: + 'Please submit printed IT Job for Task #${widget.task.taskNumber ?? widget.task.id.substring(0, 8)}', + pushData: { + 'task_id': widget.task.id, + 'navigate_to': '/tasks/${widget.task.id}', + }, + ) + .ignore(); } @override