showUploadFailedAndRetryNotification method

Future<void> showUploadFailedAndRetryNotification(
  1. String uploadId
)

Implementation

Future<void> showUploadFailedAndRetryNotification(String uploadId) async {
  try {
    const AndroidNotificationDetails androidDetails =
        AndroidNotificationDetails(
      'uploads_channel',
      'Uploads',
      channelDescription: 'Upload retry 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 - Retrying',
      'Job $uploadId failed and will retry.',
      details,
    );

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