mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0122uQ8BLHLeHDni81RBP26r
This commit is contained in:
+13
-8
@@ -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<Entry> =
|
||||
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,
|
||||
|
||||
+4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user