implemented dual Nextcloud push registration with separate general and talk apptypes to ensure reliable Talk notification delivery; introduced stacked MessagingStyle notifications for chat threads with support for circular conversation avatars and disk caching
This commit is contained in:
@@ -1,3 +1,42 @@
|
||||
/// Parsed parts of a Talk push subject text.
|
||||
///
|
||||
/// Format verified against nextcloud/spreed `Notifier::parseChatMessage`:
|
||||
/// with message preview the parsed subject is `"{user}\n{message}"` for 1:1
|
||||
/// chats and `'{user} in {call}' . "\n{message}"` for groups — header and
|
||||
/// message are separated by a NEWLINE, and the notifications app forwards the
|
||||
/// parsed subject unmodified (only shortened). The German translation of
|
||||
/// `{user} in {call}` is identical (`l10n/de.json`), so the ` in ` separator
|
||||
/// holds for de_DE. Legacy/other variants using `": "` are kept as fallback;
|
||||
/// splitting the header at the LAST ` in ` is robust against sender names
|
||||
/// containing "in" (only a display name literally containing ` in ` in a 1:1
|
||||
/// chat would still mis-split — accepted heuristic limit).
|
||||
({String sender, String? roomName, String text}) parseTalkSubject(String raw) {
|
||||
String header;
|
||||
String text;
|
||||
final newline = raw.indexOf('\n');
|
||||
if (newline > 0) {
|
||||
header = raw.substring(0, newline).trim();
|
||||
text = raw.substring(newline + 1);
|
||||
} else {
|
||||
final colon = raw.indexOf(': ');
|
||||
if (colon > 0 && colon < raw.length - 2) {
|
||||
header = raw.substring(0, colon);
|
||||
text = raw.substring(colon + 2);
|
||||
} else {
|
||||
return (sender: 'Talk', roomName: null, text: raw);
|
||||
}
|
||||
}
|
||||
final roomSep = header.lastIndexOf(' in ');
|
||||
if (roomSep > 0 && roomSep + 4 < header.length) {
|
||||
return (
|
||||
sender: header.substring(0, roomSep),
|
||||
roomName: header.substring(roomSep + 4),
|
||||
text: text,
|
||||
);
|
||||
}
|
||||
return (sender: header, roomName: null, text: text);
|
||||
}
|
||||
|
||||
/// The decrypted `subject` JSON of a Nextcloud push-v2 notification.
|
||||
///
|
||||
/// Covers the full shape the notifications app emits, including the three
|
||||
|
||||
Reference in New Issue
Block a user