From c4b0270a513bd9a8ea8fac2a609a09b7c8601321 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 7 Apr 2026 18:35:55 -0400 Subject: [PATCH] Runs notification init in the background --- .../amethyst/ui/screen/loggedIn/LoggedInPage.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoggedInPage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoggedInPage.kt index 7b842cae1..912355cf5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoggedInPage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/LoggedInPage.kt @@ -55,6 +55,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.datasource.VideoFilte import com.vitorpamplona.quartz.nip55AndroidSigner.client.IActivityLauncher import com.vitorpamplona.quartz.nip89AppHandlers.clientTag.NostrSignerWithClientTag import com.vitorpamplona.quartz.utils.Log +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @Composable @@ -137,7 +138,7 @@ fun NotificationRegistration(accountViewModel: AccountViewModel) { if (notificationPermissionState.status.isGranted) { LifecycleResumeEffect(key1 = accountViewModel, notificationPermissionState.status.isGranted) { Log.d("RegisterAccounts", "Registering for push notifications") - scope.launch { + scope.launch(Dispatchers.IO) { PushNotificationUtils.checkAndInit( LocalPreferences.allSavedAccounts(), accountViewModel.httpClientBuilder::okHttpClientForPushRegistration, @@ -152,7 +153,7 @@ fun NotificationRegistration(accountViewModel: AccountViewModel) { // no need for push permissions before 33 LifecycleResumeEffect(key1 = accountViewModel) { Log.d("RegisterAccounts", "Registering for push notifications") - scope.launch { + scope.launch(Dispatchers.IO) { PushNotificationUtils.checkAndInit( LocalPreferences.allSavedAccounts(), accountViewModel.httpClientBuilder::okHttpClientForPushRegistration,