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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZjmYpgHP4pf79Sav5QT8a
This commit is contained in:
Claude
2026-07-10 22:45:47 +00:00
parent d1ba04ad52
commit 8d528ea01c
3 changed files with 0 additions and 65 deletions
@@ -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) }
}
}
@@ -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)
-2
View File
@@ -863,8 +863,6 @@
<string name="relay_auth_per_relay_overrides">Per-relay overrides</string>
<string name="relay_auth_forget">Forget</string>
<string name="relay_auth_last_used">Last used %1$s ago</string>
<string name="relay_send_failed_title">Couldn\'t deliver your event</string>
<string name="relay_send_failed_message">The relay %1$s didn\'t accept it after several tries.</string>
<string name="relay_auth_no_overrides">Nothing here yet — your global policy applies to every relay.</string>
<string name="relay_auth_decision_allow">Allow</string>
<string name="relay_auth_decision_deny">Deny</string>