Prevent crash when removing default channel (#1405)

This commit is contained in:
Daniel Shokouhi 2021-03-08 06:00:42 -08:00 committed by GitHub
parent 94a86de4d5
commit 6109ce466c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,7 +166,7 @@ class MessagingService : FirebaseMessagingService() {
clearNotification(it["tag"]!!)
}
it[MESSAGE] == REMOVE_CHANNEL && !it["channel"].isNullOrBlank() -> {
Log.d(TAG, "Removing Notification channel ${it["tag"]}")
Log.d(TAG, "Removing Notification channel ${it["channel"]}")
removeNotificationChannel(it["channel"]!!)
}
it[MESSAGE] == TTS -> {
@ -301,7 +301,7 @@ class MessagingService : FirebaseMessagingService() {
val channelID: String = createChannelID(channelName)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && channelID != NotificationChannel.DEFAULT_CHANNEL_ID) {
notificationManagerCompat.deleteNotificationChannel(channelID)
}
}