Open krille-chan opened 1 year ago
Can confirm, text preview is available over android with a unifiedpush provider such as ntfy, don't know about anything else :p
This does not solve the problem, but might also be interesting: iOS (lock)screen widget with flutter and swift
Found it here: https://www.reddit.com/r/FlutterDev/comments/xgxh3d/ios_16_lock_screen_widgets_with_flutter/
Supposedly - at least according to some older blog posts this works or at least used to work on element/riot.im
A Notification Service Extension is required to provide message content without including message content in the APNs payload.[^1] I've wanted to work on a PR for this, but since a paid developer certificate is needed even for Simulator testing, I haven't gotten far yet.
On the technical side, the main challenge is with how Notification Service Extensions run: effectively as a different program with similar filesystem access to the main app. There's no IPC with the main app—after all, it might be closed or backgrounded.
Since API and storage is handled in the Flutter VM, either that access would need to be replicated in Swift—especially for Hive, this would be a significant effort—or there'd have to be some way to safely start up the Flutter VM on the off-chance the main app is still running. I'm not familiar enough with Flutter's internals to say if this is possible or how easy it is.
[^1]: This is how Element X iOS presents notifications: https://github.com/vector-im/element-x-ios/blob/develop/NSE/Sources/NotificationServiceExtension.swift
Thanks for the info. If it's about funding for a certificate, I would be up to help. I haven't coded reasonable amounts of Swift nor Flutter, so I cannot really help with that. I didn't know about element X iOS, I might try that.
I've gotten a setup to test out Notification Service Extension and wanted to share some of my notes. Since I didn't mention previously: the main reason I'm focusing on an NSE and not flutter_local_notifications
(which uses UNUserNotificationCenterDelegate
, I believe?) is to handle notifications when the app is killed. That said, maybe it's best to handle any cases rather than none, so I'll look at that side again.
As of Flutter 3.16.0, you can properly embed an extension-safe version of the Flutter framework in app extensions—see https://github.com/flutter/flutter/issues/16092#issuecomment-1810866582 and this doc. The latter is more focused on Share extensions, but does note this:
Due to the memory limitations of app extensions, it is only recommended to use Flutter to build app extension UI for extension types that have memory limits larger than 100MB. For example, share extensions which have a 120MB memory limit.
Frustratingly, these limits aren't officially documented anywhere. Testing on my end has shown the limit for an NSE to be 24 MB:
fluffychat.1.ui (5): EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=24 MB)
So in the case of the app being in a killed state, I'm not sure how far one could get without something like matrix-org/matrix-ios-sdk to get the room/event data—and that doesn't account for E2EE.
Maybe this flag can help: https://github.com/matrix-org/sygnal/blob/e2eaa5c988d017d0bf0f5516306c023ef3f13f2d/docs/applications.md?plain=1#L155
Or maybe this plugin for Voip. https://pub.dev/packages/flutter_callkit_incoming
On my iPhone with debug I see that the error is only here ^^. It just cannot load the matrix client.
I don't get message content (or anything informative, really) on LineageOS (unified push) either.
This issue is stale because it has been open for 120 days with no activity.
I think this is still the case
On the technical side, the main challenge is with how Notification Service Extensions run: effectively as a different program with similar filesystem access to the main app. There's no IPC with the main app—after all, it might be closed or backgrounded.
Since API and storage is handled in the Flutter VM, either that access would need to be replicated in Swift—especially for Hive, this would be a significant effort—or there'd have to be some way to safely start up the Flutter VM on the off-chance the main app is still running. I'm not familiar enough with Flutter's internals to say if this is possible or how easy it is.
If I understand it correctly, Signal’s notifications just wake up the main app and then it looks for stuff on the servers on its own. This is done to avoid leaking messages to Apple or Google servers through the notifications, but maybe it could also help here? Also not sure wether Signal users flutter, so I do apologize if my message is useless.
I’m pretty sure they made an announcement about this back when there was that whole “apple leaking notifications to the usa government” scandal, but tbh I couldn’t find it. The only place I could find mentioning this was an old reddit post linking to this file which shows the server-side implementation, but the iOS side of stuff must be somewhere in their github too.
still not work on iOS 18
Description
I am not quite sure if this feature is available on Android already, but it is a major quality of life feature. It would be nice to see the content of the message in the push notification. If the app is in the foreground, this already works, but if not I just get a generic message.
Additional information: