From f9af111dafdbf48bb20137c34e03d7e07c927577 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Jul 2026 13:29:29 +0000 Subject: [PATCH] fix(notifications): gate chess notifications behind the debug feature flag NIP-64 chess is debug-only for now (see the isDebug gate on the drawer entry), so its notifications and settings channel shouldn't appear in release. - ChessNotification.notify early-returns when !isDebug. - NotificationChannels omits the Chess channel from the settings list (and thus never creates it) in release builds. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_0122uQ8BLHLeHDni81RBP26r --- .../notifications/NotificationChannels.kt | 21 ++++++++++++------- .../renderers/ChessNotification.kt | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationChannels.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationChannels.kt index 9559161a61..7838e8e11d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationChannels.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationChannels.kt @@ -28,6 +28,7 @@ import androidx.core.app.NotificationManagerCompat import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbol import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols +import com.vitorpamplona.amethyst.isDebug import com.vitorpamplona.amethyst.service.call.notification.CallNotifier import com.vitorpamplona.amethyst.service.scheduledposts.AndroidScheduledPostNotifier import com.vitorpamplona.amethyst.ui.stringRes @@ -66,14 +67,18 @@ object NotificationChannels { * sensible settings order, plus the two non-event channels (scheduled posts, * calls) that don't map to a Nostr event kind. */ val contentChannels: List = - NotificationCategory.entries.map { category -> - Entry( - nameRes = category.channelNameRes, - icon = category.settingsIcon, - channelId = { category.channelId(it) }, - ensure = { category.ensureChannel(it) }, - ) - } + + NotificationCategory.entries + // Chess (NIP-64) is a debug-only feature for now — don't surface (or + // create) its channel in release settings. + .filter { it != NotificationCategory.CHESS || isDebug } + .map { category -> + Entry( + nameRes = category.channelNameRes, + icon = category.settingsIcon, + channelId = { category.channelId(it) }, + ensure = { category.ensureChannel(it) }, + ) + } + listOf( Entry( nameRes = R.string.app_notification_scheduled_posts_channel_name, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ChessNotification.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ChessNotification.kt index 71d3a74c0d..f3aa6bf7ab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ChessNotification.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ChessNotification.kt @@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.service.notifications.renderers import android.content.Context import androidx.annotation.StringRes import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.isDebug import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.service.notifications.NotificationCategory @@ -45,6 +46,9 @@ object ChessNotification { event: BaseChessEvent, @StringRes contentRes: Int, ) { + // NIP-64 chess is a debug-only feature for now; don't notify in release. + if (!isDebug) return + val author = LocalCache.getOrCreateUser(event.pubKey) val accountNpub = NotificationRoutes.accountNpub(account) val uri = NotificationRoutes.notificationsUri(accountNpub, event.id)