Skip to content

feat: Topic-based notification grouping#179

Open
fluffyspace wants to merge 4 commits into
binwiederhier:mainfrom
fluffyspace:topic-based-notification-grouping
Open

feat: Topic-based notification grouping#179
fluffyspace wants to merge 4 commits into
binwiederhier:mainfrom
fluffyspace:topic-based-notification-grouping

Conversation

@fluffyspace

Copy link
Copy Markdown
Contributor

Summary

Groups Android notifications by topic so each subscription behaves like a conversation thread, similar to how a messaging app groups chats per contact. When several messages arrive on the same topic they collapse under a single summary instead of competing for space in the notification shade.

What changes

  • Per-topic grouping. Each notification is tagged with a group key derived from the subscription id (ntfy_topic_<id>) so Android collapses them together natively.
  • Summary notification per topic. An inbox-style summary is created/updated whenever a topic has one or more active notifications, showing the topic name, a count, and previews of up to the 5 most recent messages.
  • Topic-prominent titles. Individual notification titles are formatted as Topic: Message so the source topic is visible at a glance in the shade.
  • Cleaner conversation title. The summary's big-content title and the per-topic prefix use the topic name (or the user's custom display name when set) instead of baseUrl/topic. The Android system-settings channel-group label still uses the full short URL, so cross-server disambiguation is unchanged.
  • Reliable cleanup. When the last notification for a topic is dismissed the summary is removed; otherwise the summary is refreshed to reflect the remaining items.

Commits in this PR

  1. feat: Add topic-based notification grouping – introduces group keys, summary notifications, inbox-style previews, and auto-cleanup.
  2. fix: Improve notification grouping visibility and reliability – always shows topic names in titles, creates summaries even for single notifications, adds count badges, fixes cleanup edge cases.
  3. fix: Use topic name only as conversation title in grouped notifications – drops the baseUrl/ prefix from the conversation title.

All changes are scoped to app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt.

Test plan

  • Subscribe to two topics on the default server; send several messages to each and confirm notifications group under one summary per topic.
  • Subscribe to a topic on a self-hosted server; verify the conversation title shows only the topic name (not server.example/topic).
  • Set a custom display name on a subscription; verify it is used as the conversation title.
  • Dismiss individual notifications and confirm the summary updates / disappears correctly.
  • With a single active message, verify the summary still renders with the correct count.
  • Open Android system notification settings and confirm the channel-group label still includes the server short URL for cross-server disambiguation.

- Group notifications by topic using Android's native notification groups
- Create summary notifications when multiple notifications exist for the same topic
- Display topic name with count and recent message previews in inbox style
- Auto-cleanup summaries when individual notifications are dismissed
- Provides messaging app-like experience where each topic acts like a contact

This improves notification organization when receiving multiple messages
from different topics, making it easier to scan and manage notifications.
- Always show topic name prominently in individual notification titles
- Format as 'Topic: Message' to clearly identify source topic
- Create summary notifications more consistently (even for single notifications)
- Add emoji and number badges to summary notifications for better visibility
- Improve summary notification content with cleaner message previews
- Fix cleanup logic to maintain summaries when notifications are dismissed
- Make topic identification much clearer in notification shade

This should resolve issues where notifications appeared ungrouped and
topic names were not visible to users.
@fluffyspace
fluffyspace marked this pull request as draft May 12, 2026 09:01
fluffyspace and others added 2 commits May 13, 2026 21:13
…ersation

Replaces the previous per-message notification + inbox-style summary with a
single MessagingStyle notification per topic that appends messages as they
arrive, similar to a chat conversation. Cancel/update paths now operate on
the per-topic notification, rebuilding it from the remaining messages.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Falls back to subscription.topic instead of {baseUrl}/{topic} when no
custom display name is set, so the MessagingStyle conversation title
matches the rest of the UI. Channel-group label in Android system
settings still uses the full short URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fluffyspace
fluffyspace force-pushed the topic-based-notification-grouping branch from 251b32e to 6c5d397 Compare May 13, 2026 19:38
@fluffyspace
fluffyspace marked this pull request as ready for review May 14, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants