Explorar el Código

Merge pull request #9114 from nextcloud/strugee/cleanup-notification-channels

Clean up notification channels
Tobias Kaminsky hace 3 años
padre
commit
ca49423faf

+ 4 - 7
src/main/java/com/owncloud/android/MainApp.java

@@ -485,11 +485,11 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
 
             if (notificationManager != null) {
                 createChannel(notificationManager, NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD,
-                              R.string.notification_channel_download_name,
+                              R.string.notification_channel_download_name_short,
                               R.string.notification_channel_download_description, context);
 
                 createChannel(notificationManager, NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD,
-                              R.string.notification_channel_upload_name,
+                              R.string.notification_channel_upload_name_short,
                               R.string.notification_channel_upload_description, context);
 
                 createChannel(notificationManager, NotificationUtils.NOTIFICATION_CHANNEL_MEDIA,
@@ -500,9 +500,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
                               R.string.notification_channel_file_sync_name,
                               R.string.notification_channel_file_sync_description, context);
 
-                createChannel(notificationManager, NotificationUtils.NOTIFICATION_CHANNEL_FILE_OBSERVER,
-                              R.string.notification_channel_file_observer_name, R.string
-                                  .notification_channel_file_observer_description, context);
+                notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_FILE_OBSERVER);
 
                 createChannel(notificationManager, NotificationUtils.NOTIFICATION_CHANNEL_PUSH,
                               R.string.notification_channel_push_name, R.string
@@ -529,8 +527,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
                                       String channelId, int channelName,
                                       int channelDescription, Context context, int importance) {
         if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O
-            && getAppContext() != null
-            && notificationManager.getNotificationChannel(channelId) == null) {
+            && getAppContext() != null) {
             CharSequence name = context.getString(channelName);
             String description = context.getString(channelDescription);
             NotificationChannel channel = new NotificationChannel(channelId, name, importance);

+ 2 - 4
src/main/res/values/strings.xml

@@ -660,16 +660,14 @@
     <string name="share">Share</string>
     <string name="link">Link</string>
 
-    <string name="notification_channel_upload_name">Upload notification channel</string>
-    <string name="notification_channel_download_name">Download notification channel</string>
+    <string name="notification_channel_upload_name_short">Uploads</string>
+    <string name="notification_channel_download_name_short">Downloads</string>
     <string name="notification_channel_download_description">Shows download progress</string>
     <string name="notification_channel_upload_description">Shows upload progress</string>
     <string name="notification_channel_media_name">Media player</string>
     <string name="notification_channel_media_description">Music player progress</string>
     <string name="notification_channel_file_sync_name">File sync</string>
     <string name="notification_channel_file_sync_description">Shows file sync progress and results</string>
-    <string name="notification_channel_file_observer_name">File observer</string>
-    <string name="notification_channel_file_observer_description">Monitors files for changes</string>
 
     <string name="account_not_found">Account not found!</string>