style: import the symbols the two merged proposals referenced inline
Both nostr proposals merged just now (82e72369, bdb4b03e) referenced types by fully-qualified name inside function bodies, which CLAUDE.md's Kotlin style rule forbids. Merged them as authored rather than rewriting someone else's patch mid-merge; this is the follow-up. - NamecoinNameResolver: import kotlinx.coroutines.CancellationException. Both catch sites were inline-qualified (one added by the proposal, one already there), and the sibling resolvers in this same package (Nip05Client, UserHexResolver) already import it. - desktop Main.kt: import the five notification symbols in the block the proposal touched — the two Preferences* factories and the three Local*Notification* CompositionLocals. Each occurs exactly once, so no fully-qualified stragglers are left behind for those names. Deliberately scoped to that block: Main.kt has ~130 other inline fully-qualified names, and sweeping them belongs in its own change, not tacked onto a style follow-up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
4e42528591
commit
9e69198623
@@ -78,6 +78,8 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.ProvideMaterialSymbols
|
||||
import com.vitorpamplona.amethyst.commons.moderation.LocalHashtagSpamSettings
|
||||
import com.vitorpamplona.amethyst.commons.moderation.LocalSpamExemptKeys
|
||||
import com.vitorpamplona.amethyst.commons.moderation.PreferencesHashtagSpamSettings
|
||||
import com.vitorpamplona.amethyst.commons.moderation.notifications.PreferencesNotificationReadState
|
||||
import com.vitorpamplona.amethyst.commons.moderation.notifications.PreferencesNotificationSettings
|
||||
import com.vitorpamplona.amethyst.commons.relayClient.auth.AuthApprovalBanner
|
||||
import com.vitorpamplona.amethyst.commons.relayClient.nip17Dm.DmInboxRelayResolver
|
||||
import com.vitorpamplona.amethyst.commons.relayClient.nip17Dm.unwrapAndUnsealOrNull
|
||||
@@ -131,6 +133,9 @@ import com.vitorpamplona.amethyst.desktop.ui.deck.param
|
||||
import com.vitorpamplona.amethyst.desktop.ui.media.LocalAwtWindow
|
||||
import com.vitorpamplona.amethyst.desktop.ui.media.LocalIsImmersiveFullscreen
|
||||
import com.vitorpamplona.amethyst.desktop.ui.media.LocalWindowState
|
||||
import com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationDispatcher
|
||||
import com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationReadState
|
||||
import com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationSettings
|
||||
import com.vitorpamplona.amethyst.desktop.ui.profile.ProfileInfoCard
|
||||
import com.vitorpamplona.amethyst.desktop.ui.relay.LocalRelayCategories
|
||||
import com.vitorpamplona.amethyst.desktop.ui.relay.RelayStatusCard
|
||||
@@ -1272,10 +1277,7 @@ private fun AppInner(
|
||||
// switch or granting permission never actually notified the auto-
|
||||
// dispatcher until the app restarted.
|
||||
val notifSettings =
|
||||
remember {
|
||||
com.vitorpamplona.amethyst.commons.moderation.notifications
|
||||
.PreferencesNotificationSettings()
|
||||
}
|
||||
remember { PreferencesNotificationSettings() }
|
||||
// Per-account read-state for the notification inbox. Keyed on
|
||||
// pubKey so switching accounts gets a fresh cursor. `remember` here
|
||||
// is intentionally keyed on pubKeyHex; a null pubKey (Loading /
|
||||
@@ -1283,10 +1285,7 @@ private fun AppInner(
|
||||
// guard against a stale ReadState leaking between accounts).
|
||||
val notifReadState =
|
||||
remember(loggedIn?.pubKeyHex) {
|
||||
loggedIn?.pubKeyHex?.let { pk ->
|
||||
com.vitorpamplona.amethyst.commons.moderation.notifications
|
||||
.PreferencesNotificationReadState(pk)
|
||||
}
|
||||
loggedIn?.pubKeyHex?.let { pk -> PreferencesNotificationReadState(pk) }
|
||||
}
|
||||
DisposableEffect(loggedIn?.pubKeyHex, notifDispatcher, localCache) {
|
||||
val myPk = loggedIn?.pubKeyHex
|
||||
@@ -1314,9 +1313,9 @@ private fun AppInner(
|
||||
LocalScheduledPostStore provides scheduledPostStore,
|
||||
com.vitorpamplona.amethyst.desktop.service.drafts.LocalNoteDraftStore provides noteDraftStore,
|
||||
LocalHashtagSpamSettings provides hashtagSpamSettings,
|
||||
com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationDispatcher provides notifDispatcher,
|
||||
com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationSettings provides notifSettings,
|
||||
com.vitorpamplona.amethyst.desktop.ui.notifications.LocalNotificationReadState provides notifReadState,
|
||||
LocalNotificationDispatcher provides notifDispatcher,
|
||||
LocalNotificationSettings provides notifSettings,
|
||||
LocalNotificationReadState provides notifReadState,
|
||||
) {
|
||||
when (accountState) {
|
||||
is AccountState.Loading -> {
|
||||
|
||||
+3
-2
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip05DnsIdentifiers.namecoin
|
||||
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
@@ -236,7 +237,7 @@ class NamecoinNameResolver(
|
||||
try {
|
||||
electrumxClient.nameShowWithFallback(parsed.namecoinName, serverListProvider())
|
||||
?: return null
|
||||
} catch (e: kotlinx.coroutines.CancellationException) {
|
||||
} catch (e: CancellationException) {
|
||||
throw e
|
||||
} catch (e: NamecoinLookupException) {
|
||||
// NameNotFound / NameExpired / ServersUnreachable → null per
|
||||
@@ -316,7 +317,7 @@ class NamecoinNameResolver(
|
||||
return NamecoinImportResolver.expandImports(root) { name ->
|
||||
try {
|
||||
electrumxClient.nameShowWithFallback(name, serverListProvider())?.value
|
||||
} catch (e: kotlinx.coroutines.CancellationException) {
|
||||
} catch (e: CancellationException) {
|
||||
throw e
|
||||
} catch (e: NamecoinLookupException) {
|
||||
// Best-effort: missing/expired/unreachable → contribute nothing.
|
||||
|
||||
Reference in New Issue
Block a user