try to fix android group issues

This commit is contained in:
Henry Hiles 2026-11-25 14:41:24 -05:00
commit b680add183
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -63,7 +63,16 @@ class NotificationController
static String payloadFor(String accountId, int rowId) => "$accountId:$rowId"; static String payloadFor(String accountId, int rowId) => "$accountId:$rowId";
static const _androidGroup = "nexus.federated.nexus.MESSAGES";
static const _summaryPayload = "summary";
void _open(String payload) { void _open(String payload) {
if (payload == _summaryPayload) {
navigatorKey.currentState?.popUntil((route) => route.isFirst);
ref.read(SidebarPageController.provider.notifier).set(.notifications);
return;
}
final (accountId, rowId) = switch (payload.split(":")) { final (accountId, rowId) = switch (payload.split(":")) {
[final accountId, final rowId] => (accountId, int.tryParse(rowId)), [final accountId, final rowId] => (accountId, int.tryParse(rowId)),
// From before notifications were per account // From before notifications were per account
@ -230,6 +239,7 @@ class NotificationController
? .new( ? .new(
"general", "general",
"General", "General",
groupKey: _androidGroup,
subText: subtitle, subText: subtitle,
silent: !sound, silent: !sound,
when: timestamp?.millisecondsSinceEpoch, when: timestamp?.millisecondsSinceEpoch,
@ -241,6 +251,7 @@ class NotificationController
: .new( : .new(
"messages", "messages",
"Messages", "Messages",
groupKey: _androidGroup,
subText: subtitle, subText: subtitle,
silent: !sound, silent: !sound,
when: timestamp?.millisecondsSinceEpoch, when: timestamp?.millisecondsSinceEpoch,
@ -281,6 +292,25 @@ class NotificationController
), ),
), ),
); );
if (Platform.isAndroid) {
await controller.show(
id: 0,
title: "Nexus",
payload: _summaryPayload,
notificationDetails: const .new(
android: .new(
"messages",
"Messages",
groupKey: _androidGroup,
setAsGroupSummary: true,
groupAlertBehavior: .children,
onlyAlertOnce: true,
silent: true,
),
),
);
}
} }
static final provider = static final provider =