Shrink signature of channel fallback creation method
This commit is contained in:
@@ -3,6 +3,7 @@ package com.github.gotify
|
|||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationChannelGroup
|
import android.app.NotificationChannelGroup
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
|
import android.app.Service
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -99,13 +100,13 @@ internal object NotificationSupport {
|
|||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
fun createChannelIfNonexistent(
|
fun createChannelIfNonexistent(
|
||||||
context: Context,
|
context: Context,
|
||||||
notificationManager: NotificationManager,
|
|
||||||
groupId: String,
|
groupId: String,
|
||||||
groupName: String,
|
|
||||||
channelId: String
|
channelId: String
|
||||||
) {
|
) {
|
||||||
if (!doesNotificationChannelExist(context, channelId)) {
|
if (!doesNotificationChannelExist(context, channelId)) {
|
||||||
createAppChannels(context, notificationManager, groupId, groupName)
|
val notificationManager = (context as Service)
|
||||||
|
.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
createAppChannels(context, notificationManager, groupId, groupId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.app.Notification
|
|||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
@@ -320,8 +319,6 @@ internal class WebSocketService : Service() {
|
|||||||
channelId = NotificationSupport.getChannelID(priority, appId.toString())
|
channelId = NotificationSupport.getChannelID(priority, appId.toString())
|
||||||
NotificationSupport.createChannelIfNonexistent(
|
NotificationSupport.createChannelIfNonexistent(
|
||||||
this,
|
this,
|
||||||
(this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager),
|
|
||||||
appId.toString(),
|
|
||||||
appId.toString(),
|
appId.toString(),
|
||||||
channelId
|
channelId
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user