From 4971bb52873839acc6d00d12730c1d36cf0ea394 Mon Sep 17 00:00:00 2001
From: DAMLA YILDIZ <56313500+damlayildiz@users.noreply.github.com>
Date: Sat, 17 Oct 2020 23:54:34 +0300
Subject: [PATCH] New channel for synchronization errors (#4545)
---
.../de/danoeh/antennapod/core/sync/SyncService.java | 2 +-
.../antennapod/core/util/gui/NotificationUtils.java | 10 ++++++++++
core/src/main/res/values/strings.xml | 4 +++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java
index 4c89ebc19..16130ac9b 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java
@@ -491,7 +491,7 @@ public class SyncService extends Worker {
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(),
R.id.pending_intent_sync_error, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new NotificationCompat.Builder(getApplicationContext(),
- NotificationUtils.CHANNEL_ID_ERROR)
+ NotificationUtils.CHANNEL_ID_SYNC_ERROR)
.setContentTitle(getApplicationContext().getString(R.string.gpodnetsync_error_title))
.setContentText(description)
.setContentIntent(pendingIntent)
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
index f546ca019..ddbe68938 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java
@@ -14,6 +14,7 @@ public class NotificationUtils {
public static final String CHANNEL_ID_DOWNLOADING = "downloading";
public static final String CHANNEL_ID_PLAYING = "playing";
public static final String CHANNEL_ID_ERROR = "error";
+ public static final String CHANNEL_ID_SYNC_ERROR = "sync_error";
public static final String CHANNEL_ID_AUTO_DOWNLOAD = "auto_download";
public static void createChannels(Context context) {
@@ -27,6 +28,7 @@ public class NotificationUtils {
mNotificationManager.createNotificationChannel(createChannelDownloading(context));
mNotificationManager.createNotificationChannel(createChannelPlaying(context));
mNotificationManager.createNotificationChannel(createChannelError(context));
+ mNotificationManager.createNotificationChannel(createChannelSyncError(context));
mNotificationManager.createNotificationChannel(createChannelAutoDownload(context));
}
}
@@ -65,6 +67,14 @@ public class NotificationUtils {
return mChannel;
}
+ @RequiresApi(api = Build.VERSION_CODES.O)
+ private static NotificationChannel createChannelSyncError(Context c) {
+ NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID_SYNC_ERROR,
+ c.getString(R.string.notification_channel_sync_error), NotificationManager.IMPORTANCE_HIGH);
+ notificationChannel.setDescription(c.getString(R.string.notification_channel_sync_error_description));
+ return notificationChannel;
+ }
+
@RequiresApi(api = Build.VERSION_CODES.O)
private static NotificationChannel createChannelAutoDownload(Context c) {
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_AUTO_DOWNLOAD,
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index 266d9d362..bcc8e6303 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -845,7 +845,9 @@
Currently playing
Allows to control playback. This is the main notification you see while playing a podcast.
Errors
- Shown if something went wrong, for example if download or gpodder sync fails.
+ Shown if something went wrong, for example if download or feed update fails.
+ Synchronization Errors
+ Shown when gpodder synchronization fails.
Auto Downloads
Shown when episodes have been automatically downloaded.