From 8d528ea01c22bfef95bedda348a1f8fda537a03b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Jul 2026 22:45:47 +0000 Subject: [PATCH] revert(relayauth): drop the "couldn't deliver your event" toast The give-up toast fired per-relay, but Nostr publishes each event to several relays (NIP-65 outbox), so one relay rejecting an event that reached the others produced a misleading "couldn't deliver" popup. It also named no event and fired mid-scroll on reconnect-driven re-pumps, so it read as random noise. Remove the toast and its subscription/strings. The low-level quartz onEventGaveUp signal stays (tested, no UI consumer) as a primitive for a future per-message send-status indicator, which is the right surface for delivery failures. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01EZjmYpgHP4pf79Sav5QT8a --- .../RelayPublishFailureToast.kt | 59 ------------------- .../ui/screen/loggedIn/LoggedInPage.kt | 4 -- amethyst/src/main/res/values/strings.xml | 2 - 3 files changed, 65 deletions(-) delete mode 100644 amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/publishOutcome/RelayPublishFailureToast.kt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/publishOutcome/RelayPublishFailureToast.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/publishOutcome/RelayPublishFailureToast.kt deleted file mode 100644 index ea1a2774f7..0000000000 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/publishOutcome/RelayPublishFailureToast.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2025 Vitor Pamplona - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package com.vitorpamplona.amethyst.service.relayClient.publishOutcome - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect -import androidx.compose.runtime.remember -import com.vitorpamplona.amethyst.Amethyst -import com.vitorpamplona.amethyst.R -import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip01Core.relay.client.listeners.RelayConnectionListener -import com.vitorpamplona.quartz.nip01Core.relay.client.single.IRelayClient - -/** - * Surfaces a toast when the relay client gives up delivering one of our events to a relay after - * exhausting its retry budget, so a failed send is visible instead of silently lost. The toast - * channel keeps only the latest message, so a burst of per-relay failures won't stack up. - */ -@Composable -fun RelayPublishFailureToastSubscription(accountViewModel: AccountViewModel) { - val client = remember { Amethyst.instance.client } - - DisposableEffect(accountViewModel) { - val listener = - object : RelayConnectionListener { - override fun onEventGaveUp( - relay: IRelayClient, - event: Event, - ) { - accountViewModel.toastManager.toast( - R.string.relay_send_failed_title, - R.string.relay_send_failed_message, - relay.url.url, - ) - } - } - client.addConnectionListener(listener) - onDispose { client.removeConnectionListener(listener) } - } -} 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 8dd2678837..49704a9575 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 @@ -45,7 +45,6 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.service.notifications.PushNotificationUtils import com.vitorpamplona.amethyst.service.relayClient.authCommand.compose.RelayAuthPromptHost import com.vitorpamplona.amethyst.service.relayClient.authCommand.compose.RelayAuthSubscription -import com.vitorpamplona.amethyst.service.relayClient.publishOutcome.RelayPublishFailureToastSubscription import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountFilterAssemblerSubscription import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountForegroundFilterAssemblerSubscription import com.vitorpamplona.amethyst.ui.navigation.AppNavigation @@ -87,9 +86,6 @@ fun LoggedInPage( // Shows the "log in to this relay?" dialog when a NIP-42 challenge needs the user to decide. RelayAuthPromptHost(accountViewModel) - // Toasts when the relay client gives up delivering one of our events to a relay. - RelayPublishFailureToastSubscription(accountViewModel) - // Loads account information + DMs and Notifications from Relays. AccountFilterAssemblerSubscription(accountViewModel) diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 05a9e01d61..9f8db12724 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -863,8 +863,6 @@ Per-relay overrides Forget Last used %1$s ago - Couldn\'t deliver your event - The relay %1$s didn\'t accept it after several tries. Nothing here yet — your global policy applies to every relay. Allow Deny