Plugin(s):
Messaging; "@capacitor-firebase/messaging": "^1.4.0", and below
Platform(s):
iOS only
Current behavior:
If a user opens a notification from the Notification Center while the app is in the background, and iOS has terminated the WebView, the notificationActionPerformed listener will not trigger inside the refreshed WebView once capacitor reloads it for you.
Context:
Expected behavior:
The notificationActionPerformed listener should be triggered inside the WebView once .reload() completes.
Steps to reproduce:
On iOS, open any Capacitor app and let it finish starting. Move the app to the background. Send a notification and leave it unopened in the Notification Center for now. At this point open quite a few other apps (our goal is to get iOS to automatically garbage collect/terminate the Capacitor appβs WebView for system memory reasons, but not to terminate the native app shell. iOS manages the memory/garbage collection of WebView's separately from your app).
Now if you open the notification from the Notification Center, the app will come to the foreground from the background. But since the WebView was terminated, .reload() gets called on it to refresh the current URL and the notificationActionPerformed listener never fires within the WebView.
Related code:
Reproducible with any implementation of the plugin that uses the notificationActionPerformed listener.
Other information:
This mainly affects users in the following way:
As far as I can tell this seems to affect all of the majority, if not all, notification capacitor plugins out there. This doesn't happen on Android because Android won't ever terminate the WebView independently from the app's native shell.
I'm thinking there should be a way to save the latest opened notification on the native side and rebroadcast it to notificationActionPerformed once the WebView is available again.
Capacitor doctor:
π Capacitor Doctor π
Latest Dependencies:
@capacitor/cli: 4.7.1
@capacitor/core: 4.7.1
@capacitor/android: 4.7.1
@capacitor/ios: 4.7.1
Installed Dependencies:
@capacitor/cli: 4.3.0
@capacitor/core: 4.3.0
@capacitor/android: 4.3.0
@capacitor/ios: 4.3.0
[success] iOS looking great! π
[success] Android looking great! π
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too