diff --git a/app/src/main/java/com/readrops/app/ReadropsApp.kt b/app/src/main/java/com/readrops/app/ReadropsApp.kt index 4c317dea..bcafcea7 100644 --- a/app/src/main/java/com/readrops/app/ReadropsApp.kt +++ b/app/src/main/java/com/readrops/app/ReadropsApp.kt @@ -4,6 +4,7 @@ import android.app.Application import android.app.NotificationChannel import android.app.NotificationManager import android.os.Build +import androidx.core.app.NotificationManagerCompat import coil.ImageLoader import coil.ImageLoaderFactory import coil.disk.DiskCache @@ -44,32 +45,21 @@ open class ReadropsApp : Application(), KoinComponent, ImageLoaderFactory { .build() } - // TODO check each channel usefulness private fun createNotificationChannels() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val feedsColorsChannel = NotificationChannel(FEEDS_COLORS_CHANNEL_ID, - getString(R.string.feeds_colors), NotificationManager.IMPORTANCE_DEFAULT) - feedsColorsChannel.description = getString(R.string.get_feeds_colors) - - val opmlExportChannel = NotificationChannel(OPML_EXPORT_CHANNEL_ID, - getString(R.string.opml_export), NotificationManager.IMPORTANCE_DEFAULT) - opmlExportChannel.description = getString(R.string.opml_export_description) - - val syncChannel = NotificationChannel(SYNC_CHANNEL_ID, - getString(R.string.auto_synchro), NotificationManager.IMPORTANCE_LOW) + val syncChannel = NotificationChannel( + SYNC_CHANNEL_ID, + getString(R.string.auto_synchro), + NotificationManager.IMPORTANCE_LOW + ) syncChannel.description = getString(R.string.account_synchro) - val manager = getSystemService(NotificationManager::class.java)!! - - manager.createNotificationChannel(feedsColorsChannel) - manager.createNotificationChannel(opmlExportChannel) - manager.createNotificationChannel(syncChannel) + NotificationManagerCompat.from(this) + .createNotificationChannel(syncChannel) } } companion object { - const val FEEDS_COLORS_CHANNEL_ID = "feedsColorsChannel" - const val OPML_EXPORT_CHANNEL_ID = "opmlExportChannel" const val SYNC_CHANNEL_ID = "syncChannel" } } \ No newline at end of file