Shrink signature of channel fallback creation method

This commit is contained in:
Niko Diamadis
2023-02-17 15:45:41 +01:00
parent 38bd1b5e32
commit 5399d003e4
2 changed files with 4 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package com.github.gotify
import android.app.NotificationChannel
import android.app.NotificationChannelGroup
import android.app.NotificationManager
import android.app.Service
import android.content.Context
import android.graphics.Color
import android.os.Build
@@ -99,13 +100,13 @@ internal object NotificationSupport {
@RequiresApi(api = Build.VERSION_CODES.O)
fun createChannelIfNonexistent(
context: Context,
notificationManager: NotificationManager,
groupId: String,
groupName: String,
channelId: String
) {
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)
}
}

View File

@@ -5,7 +5,6 @@ import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.Color
@@ -320,8 +319,6 @@ internal class WebSocketService : Service() {
channelId = NotificationSupport.getChannelID(priority, appId.toString())
NotificationSupport.createChannelIfNonexistent(
this,
(this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager),
appId.toString(),
appId.toString(),
channelId
)