mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Refactored `initNotificationChannels`
				
					
				
			This commit is contained in:
		| @@ -32,7 +32,7 @@ import org.schabi.newpipe.util.StateSaver; | |||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InterruptedIOException; | import java.io.InterruptedIOException; | ||||||
| import java.net.SocketException; | import java.net.SocketException; | ||||||
| import java.util.Arrays; | import java.util.ArrayList; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| @@ -225,45 +225,44 @@ public class App extends MultiDexApplication { | |||||||
|     private void initNotificationChannels() { |     private void initNotificationChannels() { | ||||||
|         // Keep the importance below DEFAULT to avoid making noise on every notification update for |         // Keep the importance below DEFAULT to avoid making noise on every notification update for | ||||||
|         // the main and update channels |         // the main and update channels | ||||||
|         final NotificationChannelCompat mainChannel = new NotificationChannelCompat |         final List<NotificationChannelCompat> notificationChannelCompats = new ArrayList<>(); | ||||||
|  |         notificationChannelCompats.add(new NotificationChannelCompat | ||||||
|                 .Builder(getString(R.string.notification_channel_id), |                 .Builder(getString(R.string.notification_channel_id), | ||||||
|                         NotificationManagerCompat.IMPORTANCE_LOW) |                         NotificationManagerCompat.IMPORTANCE_LOW) | ||||||
|                 .setName(getString(R.string.notification_channel_name)) |                 .setName(getString(R.string.notification_channel_name)) | ||||||
|                 .setDescription(getString(R.string.notification_channel_description)) |                 .setDescription(getString(R.string.notification_channel_description)) | ||||||
|                 .build(); |                 .build()); | ||||||
|  |  | ||||||
|         final NotificationChannelCompat appUpdateChannel = new NotificationChannelCompat |         notificationChannelCompats.add(new NotificationChannelCompat | ||||||
|                 .Builder(getString(R.string.app_update_notification_channel_id), |                 .Builder(getString(R.string.app_update_notification_channel_id), | ||||||
|                         NotificationManagerCompat.IMPORTANCE_LOW) |                         NotificationManagerCompat.IMPORTANCE_LOW) | ||||||
|                 .setName(getString(R.string.app_update_notification_channel_name)) |                 .setName(getString(R.string.app_update_notification_channel_name)) | ||||||
|                 .setDescription(getString(R.string.app_update_notification_channel_description)) |                 .setDescription(getString(R.string.app_update_notification_channel_description)) | ||||||
|                 .build(); |                 .build()); | ||||||
|  |  | ||||||
|         final NotificationChannelCompat hashChannel = new NotificationChannelCompat |         notificationChannelCompats.add(new NotificationChannelCompat | ||||||
|                 .Builder(getString(R.string.hash_channel_id), |                 .Builder(getString(R.string.hash_channel_id), | ||||||
|                         NotificationManagerCompat.IMPORTANCE_HIGH) |                         NotificationManagerCompat.IMPORTANCE_HIGH) | ||||||
|                 .setName(getString(R.string.hash_channel_name)) |                 .setName(getString(R.string.hash_channel_name)) | ||||||
|                 .setDescription(getString(R.string.hash_channel_description)) |                 .setDescription(getString(R.string.hash_channel_description)) | ||||||
|                 .build(); |                 .build()); | ||||||
|  |  | ||||||
|         final NotificationChannelCompat errorReportChannel = new NotificationChannelCompat |         notificationChannelCompats.add(new NotificationChannelCompat | ||||||
|                 .Builder(getString(R.string.error_report_channel_id), |                 .Builder(getString(R.string.error_report_channel_id), | ||||||
|                         NotificationManagerCompat.IMPORTANCE_LOW) |                         NotificationManagerCompat.IMPORTANCE_LOW) | ||||||
|                 .setName(getString(R.string.error_report_channel_name)) |                 .setName(getString(R.string.error_report_channel_name)) | ||||||
|                 .setDescription(getString(R.string.error_report_channel_description)) |                 .setDescription(getString(R.string.error_report_channel_description)) | ||||||
|                 .build(); |                 .build()); | ||||||
|  |  | ||||||
|  |         notificationChannelCompats.add(new NotificationChannelCompat | ||||||
|         final NotificationChannelCompat newStreamsChannel = new NotificationChannelCompat |  | ||||||
|                 .Builder(getString(R.string.streams_notification_channel_id), |                 .Builder(getString(R.string.streams_notification_channel_id), | ||||||
|                     NotificationManagerCompat.IMPORTANCE_DEFAULT) |                     NotificationManagerCompat.IMPORTANCE_DEFAULT) | ||||||
|                 .setName(getString(R.string.streams_notification_channel_name)) |                 .setName(getString(R.string.streams_notification_channel_name)) | ||||||
|                 .setDescription(getString(R.string.streams_notification_channel_description)) |                 .setDescription(getString(R.string.streams_notification_channel_description)) | ||||||
|                 .build(); |                 .build()); | ||||||
|  |  | ||||||
|         final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); |         final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); | ||||||
|         notificationManager.createNotificationChannelsCompat(Arrays.asList(mainChannel, |         notificationManager.createNotificationChannelsCompat(notificationChannelCompats); | ||||||
|                 appUpdateChannel, hashChannel, errorReportChannel, newStreamsChannel)); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected boolean isDisposedRxExceptionsReported() { |     protected boolean isDisposedRxExceptionsReported() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 litetex
					litetex