Remove unused notification channels

This commit is contained in:
Shinokuni 2024-07-31 16:03:24 +02:00
parent 70d66f3200
commit 4d9f71559f
1 changed files with 8 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import android.app.Application
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
import android.os.Build import android.os.Build
import androidx.core.app.NotificationManagerCompat
import coil.ImageLoader import coil.ImageLoader
import coil.ImageLoaderFactory import coil.ImageLoaderFactory
import coil.disk.DiskCache import coil.disk.DiskCache
@ -44,32 +45,21 @@ open class ReadropsApp : Application(), KoinComponent, ImageLoaderFactory {
.build() .build()
} }
// TODO check each channel usefulness
private fun createNotificationChannels() { private fun createNotificationChannels() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val feedsColorsChannel = NotificationChannel(FEEDS_COLORS_CHANNEL_ID, val syncChannel = NotificationChannel(
getString(R.string.feeds_colors), NotificationManager.IMPORTANCE_DEFAULT) SYNC_CHANNEL_ID,
feedsColorsChannel.description = getString(R.string.get_feeds_colors) getString(R.string.auto_synchro),
NotificationManager.IMPORTANCE_LOW
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)
syncChannel.description = getString(R.string.account_synchro) syncChannel.description = getString(R.string.account_synchro)
val manager = getSystemService(NotificationManager::class.java)!! NotificationManagerCompat.from(this)
.createNotificationChannel(syncChannel)
manager.createNotificationChannel(feedsColorsChannel)
manager.createNotificationChannel(opmlExportChannel)
manager.createNotificationChannel(syncChannel)
} }
} }
companion object { companion object {
const val FEEDS_COLORS_CHANNEL_ID = "feedsColorsChannel"
const val OPML_EXPORT_CHANNEL_ID = "opmlExportChannel"
const val SYNC_CHANNEL_ID = "syncChannel" const val SYNC_CHANNEL_ID = "syncChannel"
} }
} }