showUploadFailedNotification method

Future<void> showUploadFailedNotification(
  1. String uploadId
)

Implementation

Future<void> showUploadFailedNotification(String uploadId) async {
  try {
    const AndroidNotificationDetails androidDetails =
        AndroidNotificationDetails(
      'uploads_channel',
      'Uploads',
      channelDescription: 'Upload failed notifications',
      importance: Importance.max,
      priority: Priority.high,
      showWhen: true,
      enableVibration: true,
      playSound: true,
    );

    const DarwinNotificationDetails iosDetails = DarwinNotificationDetails(
      presentAlert: true,
      presentBadge: true,
      presentSound: true,
    );

    const NotificationDetails details = NotificationDetails(
      android: androidDetails,
      iOS: iosDetails,
    );

    await _plugin.show(
      uploadId.hashCode,
      'Upload Failed',
      'Job $uploadId failed permanently.',
      details,
    );

    debugPrint('Failure notification shown for: $uploadId');
  } catch (e) {
    debugPrint('Failed to show failure notification: $e');
  }
}