diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationUtils.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationUtils.kt index 1938019e4..e07f5677e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationUtils.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationUtils.kt @@ -43,7 +43,7 @@ object NotificationUtils { private const val DM_GROUP_KEY = "com.vitorpamplona.amethyst.DM_NOTIFICATION" private const val ZAP_GROUP_KEY = "com.vitorpamplona.amethyst.ZAP_NOTIFICATION" - fun NotificationManager.getOrCreateDMChannel(applicationContext: Context): NotificationChannel { + fun getOrCreateDMChannel(applicationContext: Context): NotificationChannel { if (dmChannel != null) return dmChannel!! dmChannel = @@ -65,7 +65,7 @@ object NotificationUtils { return dmChannel!! } - fun NotificationManager.getOrCreateZapChannel(applicationContext: Context): NotificationChannel { + fun getOrCreateZapChannel(applicationContext: Context): NotificationChannel { if (zapChannel != null) return zapChannel!! zapChannel = @@ -153,7 +153,7 @@ object NotificationUtils { val imageLoader = ImageLoader(applicationContext) val imageResult = imageLoader.executeBlocking(request) - sendNotification( + sendNotificationInner( id = id, messageBody = messageBody, messageTitle = messageTitle, @@ -165,7 +165,7 @@ object NotificationUtils { applicationContext = applicationContext, ) } else { - sendNotification( + sendNotificationInner( id = id, messageBody = messageBody, messageTitle = messageTitle, @@ -179,7 +179,7 @@ object NotificationUtils { } } - private fun NotificationManager.sendNotification( + private fun NotificationManager.sendNotificationInner( id: String, messageBody: String, messageTitle: String, diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt index 57e045df1..58c1a3844 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/notifications/PushNotificationReceiverService.kt @@ -28,8 +28,6 @@ import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage import com.vitorpamplona.amethyst.Amethyst import com.vitorpamplona.amethyst.LocalPreferences -import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.getOrCreateDMChannel -import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.getOrCreateZapChannel import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import kotlinx.coroutines.CoroutineExceptionHandler @@ -92,8 +90,8 @@ class PushNotificationReceiverService : FirebaseMessagingService() { PushNotificationUtils.checkAndInit(token, LocalPreferences.allSavedAccounts()) { Amethyst.instance.okHttpClients.getHttpClient(Amethyst.instance.torManager.isSocksReady()) } - notificationManager().getOrCreateZapChannel(applicationContext) - notificationManager().getOrCreateDMChannel(applicationContext) + NotificationUtils.getOrCreateZapChannel(applicationContext) + NotificationUtils.getOrCreateDMChannel(applicationContext) } }