-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PN metadata leak, PN navigation to chat, and unexpected PNs from other accounts #6893
Conversation
Pull Request Checklist
|
Observations after the migration from Notifications API to Messaging API:
UPDATE: Turned out it was due to the |
9dcf0bb
to
6f402a0
Compare
553327b
to
30a65fd
Compare
The work in this PR can be leveraged for #2984, if we can access the app db from the background task to only create PN if last logged in account matches |
dddf523
to
d3c24cf
Compare
d3c24cf
to
8c70a62
Compare
8c70a62
to
3ae5e1d
Compare
c98f1ad
to
9c80828
Compare
ios app crashes if
|
seems like this is expected, from now on PN will not be received if app is closed |
@rasom why it is expected? |
This is only expected on iOS. Android has provisions to deal with starting up the app through a background task if needed (see link to docs in OP). On iOS, we should show the notifications to the user once he starts the app/logs back in. |
@pombeirp 3. Is it expected that there is no redirection to chat or options (like open, reply) when you click on PN on any desktop platform? Will it be separate fix for desktop? |
This PR is only about metadata leaks (with some other low-hanging fruit that was simple to fix related to the changes). The issues that you're mentioning are more about UX and will probably be handled by the desktop team. |
@pombeirp
but unfortunately, a headless task is not called after that, because the app is killed. I doubt that we can do anything about this except have some handling on native side. |
This is something that was definitely working in the PR, however the last time I looked into it, the app was started so that the background task can be invoked, but seemed to crash while initializing the app, not sure why. A log entry showing |
This exception happens if the app was force closed, it is not related to initialization in any way. You just need to force close application, the when PN is received by background service it can't find the headless task. |
I guess we need to log if |
Yes, it is called, it works just fine until the app is force closed. So if you put it into the background - there is no exception or anything. When you force close the app and send PN - exception happens, but it is kind of "silent" and can be seen only in the logs. As long as the app is not running. |
Also i doubt that's about starting the app from FCM. This happens only when we tap on a notification, and it works. |
@rasom This somehow worked before, even after force-closing the app (tested that many times) so I thought that FCM service would start our app if needed (which would then register the headless task). This is also what is shown in the docs, as you can see there's a column for when the app is in the background, and another for when the app is closed, and they both mention it will work due to the background task on Android. |
ok, the app is not started on message only when i'm running it in debug mode. Otherwise, it is started, though PN is shown only if notification passes |
Ah, that check must have been added afterward. I guess if we wanted we could use the |
@pombeirp trying this now |
fixes #6772, #3488 and #2984, depends on status-im/status-go#1297
Summary:
Pre-PR example payload:
Same payload post-PR (notice versioning):
This PR:
hash:${msg-v2/id}
, creating a 1:1 link between Whisper messages and their respective PN on the receiver sidemsg-v2/from
,msg-v2/to
,msg-v2/id
:push-notifications/stored
)Only create PN if message with hash equal tomsg-v2/id
is not marked as seenconfig/in-app-notifications-enabled?
/IN_APP_NOTIFICATIONS_ENABLED
Removes dependency on NotifyUsers status-go API by leveraging react-native-firebase APIthe API does not support some critical properties for Android and iOS, so we must continue with the implementation in status-go for the time being. Created a suggestion at https://boards.invertase.io/react-native-firebase/p/add-missing-properties-to-messagingremotemessage.Review notes (optional):
This PR paves the way to fix issues like #3488, #3487, #2984
Testing notes (optional):
Platforms
Check that new apps can receive PNs from both new and old clients. I've tested Desktop and Android, but not iOS.
See here for expected behavior from a technical perspective: https://github.com/invertase/react-native-firebase-docs/blob/master/docs/messaging/introduction.md#data-only-messages
Areas that maybe impacted
Functional
Steps to test:
Future steps
With this PR implemented, we can easily implement the following:
status: ready