From 53424a84d0bda0949fea4cde64f557ad0f059b54 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 30 Aug 2024 13:16:32 -0300 Subject: [PATCH] Dont register to the push server when using direct connection --- .../greenart7c3/nostrsigner/service/PushNotificationUtils.kt | 2 +- .../greenart7c3/nostrsigner/service/PushNotificationUtils.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/free/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt b/app/src/free/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt index 6725883d..784854e4 100644 --- a/app/src/free/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt +++ b/app/src/free/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt @@ -44,7 +44,7 @@ object PushNotificationUtils { @OptIn(DelicateCoroutinesApi::class) suspend fun init(accounts: List) { - if (hasInit) { + if (hasInit || NostrSigner.getInstance().settings.notificationType == NotificationType.DIRECT) { return } diff --git a/app/src/play/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt b/app/src/play/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt index 65bc4c3d..bb7cd105 100644 --- a/app/src/play/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt +++ b/app/src/play/java/com/greenart7c3/nostrsigner/service/PushNotificationUtils.kt @@ -23,7 +23,9 @@ package com.greenart7c3.nostrsigner.service import android.util.Log import com.google.firebase.messaging.FirebaseMessaging import com.greenart7c3.nostrsigner.AccountInfo +import com.greenart7c3.nostrsigner.NostrSigner import com.greenart7c3.nostrsigner.ui.AccountStateViewModel +import com.greenart7c3.nostrsigner.ui.NotificationType import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.tasks.await @@ -34,7 +36,7 @@ object PushNotificationUtils { suspend fun init(accounts: List) = with(Dispatchers.IO) { - if (hasInit) { + if (hasInit || NostrSigner.getInstance().settings.notificationType == NotificationType.DIRECT) { return@with } // get user notification token provided by firebase